test/hotspot/jtreg/runtime/appcds/test-classes/JvmtiApp.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
open Cdiff test/hotspot/jtreg/runtime/appcds/test-classes/JvmtiApp.java
test/hotspot/jtreg/runtime/appcds/test-classes/JvmtiApp.java
Print this page
rev 49528 : [mq]: module_path
*** 1,7 ****
/*
! * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 23,35 ****
*/
import sun.hotspot.WhiteBox;
public class JvmtiApp {
! static Class forname() {
try {
! return Class.forName("Hello");
} catch (Throwable t) {
return null;
}
}
--- 23,35 ----
*/
import sun.hotspot.WhiteBox;
public class JvmtiApp {
! static Class forname(String cn) {
try {
! return Class.forName(cn);
} catch (Throwable t) {
return null;
}
}
*** 38,50 ****
System.exit(1);
}
// See ../JvmtiAddPath.java for how the classpaths are configured.
public static void main(String args[]) {
if (args[0].equals("noadd")) {
! if (forname() != null) {
! failed("Hello class was loaded unexpectedly");
}
// We use -verbose:class to verify that Extra.class IS loaded by AppCDS if
// the boot classpath HAS NOT been appended.
ExtraClass.doit();
System.exit(0);
--- 38,55 ----
System.exit(1);
}
// See ../JvmtiAddPath.java for how the classpaths are configured.
public static void main(String args[]) {
+ String cn = "Hello";
+ if (args.length >= 3) {
+ cn = args[args.length - 1];
+ }
+
if (args[0].equals("noadd")) {
! if (forname(cn) != null) {
! failed(cn + " class was loaded unexpectedly");
}
// We use -verbose:class to verify that Extra.class IS loaded by AppCDS if
// the boot classpath HAS NOT been appended.
ExtraClass.doit();
System.exit(0);
*** 52,94 ****
WhiteBox wb = WhiteBox.getWhiteBox();
if (args[0].equals("bootonly")) {
wb.addToBootstrapClassLoaderSearch(args[1]);
! Class cls = forname();
if (cls == null) {
! failed("Cannot find Hello class");
}
if (cls.getClassLoader() != null) {
failed("Hello class not loaded by boot classloader");
}
} else if (args[0].equals("apponly")) {
wb.addToSystemClassLoaderSearch(args[1]);
! Class cls = forname();
if (cls == null) {
! failed("Cannot find Hello class");
}
if (cls.getClassLoader() != JvmtiApp.class.getClassLoader()) {
! failed("Hello class not loaded by app classloader");
}
} else if (args[0].equals("noadd-appcds")) {
! Class cls = forname();
if (cls == null) {
! failed("Cannot find Hello class");
}
if (cls.getClassLoader() != JvmtiApp.class.getClassLoader()) {
! failed("Hello class not loaded by app classloader");
}
} else if (args[0].equals("appandboot")) {
wb.addToBootstrapClassLoaderSearch(args[1]);
wb.addToSystemClassLoaderSearch(args[2]);
! Class cls = forname();
if (cls == null) {
! failed("Cannot find Hello class");
}
if (cls.getClassLoader() != null) {
! failed("Hello class not loaded by boot classloader");
}
} else {
failed("unknown option " + args[0]);
}
--- 57,101 ----
WhiteBox wb = WhiteBox.getWhiteBox();
if (args[0].equals("bootonly")) {
wb.addToBootstrapClassLoaderSearch(args[1]);
! Class cls = forname(cn);
if (cls == null) {
! failed("Cannot find " + cn + " class");
}
if (cls.getClassLoader() != null) {
failed("Hello class not loaded by boot classloader");
}
} else if (args[0].equals("apponly")) {
wb.addToSystemClassLoaderSearch(args[1]);
! Class cls = forname(cn);
if (cls == null) {
! failed("Cannot find " + cn + " class");
}
if (cls.getClassLoader() != JvmtiApp.class.getClassLoader()) {
! failed(cn + " class not loaded by app classloader");
}
} else if (args[0].equals("noadd-appcds")) {
! cn = (args.length == 1) ? "Hello" : args[1];
! Class cls = forname(cn);
if (cls == null) {
! failed("Cannot find " + cn + " class");
}
if (cls.getClassLoader() != JvmtiApp.class.getClassLoader()) {
! failed(cn + " class not loaded by app classloader");
}
} else if (args[0].equals("appandboot")) {
wb.addToBootstrapClassLoaderSearch(args[1]);
wb.addToSystemClassLoaderSearch(args[2]);
! cn = (args.length == 3) ? "Hello" : args[3];
! Class cls = forname(cn);
if (cls == null) {
! failed("Cannot find " + cn + " class");
}
if (cls.getClassLoader() != null) {
! failed(cn + " class not loaded by boot classloader");
}
} else {
failed("unknown option " + args[0]);
}
test/hotspot/jtreg/runtime/appcds/test-classes/JvmtiApp.java
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File