1 /*
2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.
8  *
9  * This code is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12  * version 2 for more details (a copy is included in the LICENSE file that
13  * accompanied this code).
14  *
15  * You should have received a copy of the GNU General Public License version
16  * 2 along with this work; if not, write to the Free Software Foundation,
17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18  *
19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20  * or visit www.oracle.com if you need additional information or have any
21  * questions.
22  */
23 
24 
25 /*
26  * @test
27  *
28  * @summary converted from VM Testbase nsk/jdi/VirtualMachine/redefineClasses/redefineclasses034.
29  * VM Testbase keywords: [quick, jpda, jdi, redefine]
30  * VM Testbase readme:
31  * DESCRIPTION:
32  *     The test checks up com.sun.jdi.VirtualMachine.redefineClasses()
33  *     in case when redefined class loaded by a custom loader.
34  *     The test perform next steps:
35  *         1. Debugee loads a tested class by the custom loader.
36  *         2. When getting ClassPrepareEvent, debugger checks
37  *            class loader of tested class to be the custom class loader.
38  *         3. Debugger redefines the tested class and checks the redefinition
39  *            to be successful.
40  *     The abose steps are performed for two cases, when the custom loader
41  *     extends java.net.URLClassLoader and when the custom loader directly
42  *     extends java.lang.ClassLoader.
43  * COMMENTS
44  *     The test was developed as a regression test for
45  *     #4739099 JDI HotSwap class file replacement with custom classloader broken
46  *     12/20/2002 test was fixed according to test bug 4778296:
47  *         - handling VMStartEvent was removed from the debugger part of the test
48  *         - quit on VMDeathEvent was added to the event handling loop
49  *     Test updated to wait for debugee VM exit:
50  *     - standard method Debugee.endDebugee() is used instead of final Debugee.resume()
51  *
52  * @library /vmTestbase
53  *          /test/lib
54  * @run driver jdk.test.lib.FileInstaller . .
55  * @build nsk.jdi.VirtualMachine.redefineClasses.redefineclasses034
56  *        nsk.jdi.VirtualMachine.redefineClasses.redefineclasses034a
57  *
58  * @comment make sure redefineclasses034a is compiled with full debug info
59  * @clean nsk.jdi.VirtualMachine.redefineClasses.redefineclasses034a
60  * @compile -g:lines,source,vars ../redefineclasses034a.java
61  *
62  * @comment compile loadclassXX to bin/loadclassXX
63  *          with full debug info
64  * @run driver nsk.share.ExtraClassesBuilder
65  *      -g:lines,source,vars
66  *      loadclass
67  *
68  * @comment compile newclassXX to bin/newclassXX
69  *          with full debug info
70  * @run driver nsk.share.ExtraClassesBuilder
71  *      -g:lines,source,vars
72  *      newclass
73  *
74  * @run main/othervm PropertyResolvingWrapper
75  *      nsk.jdi.VirtualMachine.redefineClasses.redefineclasses034
76  *      ./bin
77  *      -verbose
78  *      -arch=${os.family}-${os.simpleArch}
79  *      -waittime=5
80  *      -debugee.vmkind=java
81  *      -transport.address=dynamic
82  *      "-debugee.vmkeys=${test.vm.opts} ${test.java.opts}"
83  */
84 
85