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 * @test 26 * @summary Redefine a class with an UnresolvedClass reference in the constant pool. 27 * @bug 8035150 28 * @library /testlibrary 29 * @modules java.base/jdk.internal.misc 30 * java.compiler 31 * java.instrument 32 * java.management 33 * jdk.jartool/sun.tools.jar 34 * jdk.jvmstat/sun.jvmstat.monitor 35 * @build jdk.test.lib.* UnresolvedClassAgent 36 * @run main TestRedefineWithUnresolvedClass 37 */ 38 39 import java.io.File; 40 import java.util.Arrays; 41 42 import jdk.test.lib.OutputAnalyzer; 43 import jdk.test.lib.ProcessTools; 44 45 public class TestRedefineWithUnresolvedClass { 46 47 final static String slash = File.separator; 48 final static String testClasses = System.getProperty("test.classes") + slash; 49 50 public static void main(String... args) throws Throwable { 51 // delete this class to cause a NoClassDefFoundError 52 File unresolved = new File(testClasses, "MyUnresolvedClass.class"); 53 if (unresolved.exists() && !unresolved.delete()) { 54 throw new Exception("Could not delete: " + unresolved); 55 } 56 57 // build the javaagent 58 buildJar("UnresolvedClassAgent"); 59 60 // launch a VM with the javaagent 61 launchTest(); 62 } 63 | 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 * @test 26 * @summary Redefine a class with an UnresolvedClass reference in the constant pool. 27 * @bug 8035150 28 * @library /test/lib 29 * @modules java.base/jdk.internal.misc 30 * java.compiler 31 * java.instrument 32 * java.management 33 * jdk.jartool/sun.tools.jar 34 * jdk.jvmstat/sun.jvmstat.monitor 35 * @build UnresolvedClassAgent 36 * @run main TestRedefineWithUnresolvedClass 37 */ 38 39 import java.io.File; 40 import java.util.Arrays; 41 42 import jdk.test.lib.process.OutputAnalyzer; 43 import jdk.test.lib.process.ProcessTools; 44 45 public class TestRedefineWithUnresolvedClass { 46 47 final static String slash = File.separator; 48 final static String testClasses = System.getProperty("test.classes") + slash; 49 50 public static void main(String... args) throws Throwable { 51 // delete this class to cause a NoClassDefFoundError 52 File unresolved = new File(testClasses, "MyUnresolvedClass.class"); 53 if (unresolved.exists() && !unresolved.delete()) { 54 throw new Exception("Could not delete: " + unresolved); 55 } 56 57 // build the javaagent 58 buildJar("UnresolvedClassAgent"); 59 60 // launch a VM with the javaagent 61 launchTest(); 62 } 63 |