Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/RedefineClasses/redefinecls001b.java
41161 views
/*1* Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package nsk.jdwp.VirtualMachine.RedefineClasses;2425import nsk.share.*;2627/**28* This class is to be redefined.29*/30public class redefinecls001b {3132// values for tested fields33public static final int INITIAL_FIELD_VALUE = 111;34public static final int FINAL_FIELD_VALUE = 222;3536// values for method redefinition37public static final int METHOD_NOT_INVOKED = 0;38public static final int REDEFINED_METHOD_INVOKED = 10;39public static final int NOT_REDEFINED_METHOD_INVOKED = 20;4041// static field42public static int staticField = INITIAL_FIELD_VALUE;43// object field44public int objectField = INITIAL_FIELD_VALUE;4546public static Log log;47// fields for methods redefinition results48public static int constructorInvoked = METHOD_NOT_INVOKED;49public static int staticMethodInvoked = METHOD_NOT_INVOKED;50public static int objectMethodInvoked = METHOD_NOT_INVOKED;5152// constructor53public redefinecls001b(int value) {54log.display("Constructor invoked: NOT REDEFINED");55constructorInvoked = NOT_REDEFINED_METHOD_INVOKED;56objectField = value;57}5859// static method to be redefined60public static void testedStaticMethod() {61log.display("Static method invoked: NOT REDEFINED");62staticMethodInvoked = NOT_REDEFINED_METHOD_INVOKED;6364log.display("Static fields values:");65log.display(" staticField: " + staticField66+ " (expected: " + FINAL_FIELD_VALUE + ")");67}6869// object method to be redefined70public void testedObjectMethod() {71log.display("Object method invoked: NOT REDEFINED");72objectMethodInvoked = NOT_REDEFINED_METHOD_INVOKED;7374log.display("Object fields values:");75log.display(" objectField: " + objectField76+ " (expected: " + FINAL_FIELD_VALUE + ")"); // BREAKPOINT_LINE_BEFORE77}78}798081