20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 /*
26 * @test
27 * @summary Test a few scenarios if an empty class, which has the same name as the one in the jimage, is specified in the -Xbootclasspath/a
28 * 1) boot loader will always load the class from the bootclasspath
29 * 2) app loader will load the class from the jimage by default;
30 * app loader will load the class from the bootclasspath if the
31 * "--limit-modules java.base" option is specified
32 * @requires vm.cds & !vm.graal.enabled
33 * @library /test/lib /test/hotspot/jtreg/runtime/appcds
34 * @modules java.base/jdk.internal.misc
35 * java.management
36 * jdk.jartool/sun.tools.jar
37 * jdk.internal.jvmstat/sun.jvmstat.monitor
38 * @compile ../../test-classes/EmptyClassHelper.java
39 * @compile ../../test-classes/com/sun/tools/javac/Main.jasm
40 * @run main EmptyClassInBootClassPath
41 */
42
43 import java.io.File;
44 import java.lang.*;
45 import java.lang.reflect.*;
46 import java.util.List;
47 import java.util.ArrayList;
48 import jdk.test.lib.process.OutputAnalyzer;
49
50 public class EmptyClassInBootClassPath {
51 static final String EXPECTED_EXCEPTION =
52 "java.lang.NoSuchMethodException: com.sun.tools.javac.Main.main([Ljava.lang.String;)";
53 public static void main(String[] args) throws Exception {
54 String[] className = {"com/sun/tools/javac/Main"};
55 JarBuilder.build("emptyClass", className);
56 String appJar = TestCommon.getTestJar("emptyClass.jar");
57 JarBuilder.build("EmptyClassHelper", "EmptyClassHelper");
58 String helperJar = TestCommon.getTestJar("EmptyClassHelper.jar");
59 OutputAnalyzer dumpOutput = TestCommon.dump(
60 appJar, className, "-Xbootclasspath/a:" + appJar);
|
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 /*
26 * @test
27 * @summary Test a few scenarios if an empty class, which has the same name as the one in the jimage, is specified in the -Xbootclasspath/a
28 * 1) boot loader will always load the class from the bootclasspath
29 * 2) app loader will load the class from the jimage by default;
30 * app loader will load the class from the bootclasspath if the
31 * "--limit-modules java.base" option is specified
32 * @requires vm.cds & !vm.graal.enabled
33 * @library /test/lib /test/hotspot/jtreg/runtime/appcds
34 * @modules java.base/jdk.internal.misc
35 * java.management
36 * jdk.jartool/sun.tools.jar
37 * jdk.internal.jvmstat/sun.jvmstat.monitor
38 * @compile ../../test-classes/EmptyClassHelper.java
39 * @compile ../../test-classes/com/sun/tools/javac/Main.jasm
40 * @run driver EmptyClassInBootClassPath
41 */
42
43 import java.io.File;
44 import java.lang.*;
45 import java.lang.reflect.*;
46 import java.util.List;
47 import java.util.ArrayList;
48 import jdk.test.lib.process.OutputAnalyzer;
49
50 public class EmptyClassInBootClassPath {
51 static final String EXPECTED_EXCEPTION =
52 "java.lang.NoSuchMethodException: com.sun.tools.javac.Main.main([Ljava.lang.String;)";
53 public static void main(String[] args) throws Exception {
54 String[] className = {"com/sun/tools/javac/Main"};
55 JarBuilder.build("emptyClass", className);
56 String appJar = TestCommon.getTestJar("emptyClass.jar");
57 JarBuilder.build("EmptyClassHelper", "EmptyClassHelper");
58 String helperJar = TestCommon.getTestJar("EmptyClassHelper.jar");
59 OutputAnalyzer dumpOutput = TestCommon.dump(
60 appJar, className, "-Xbootclasspath/a:" + appJar);
|