42 public class ArrayTest { |
42 public class ArrayTest { |
43 |
43 |
44 static String arrayClasses[] = { |
44 static String arrayClasses[] = { |
45 "ArrayTestHelper", |
45 "ArrayTestHelper", |
46 "[Ljava/lang/Comparable;", |
46 "[Ljava/lang/Comparable;", |
47 "[I" |
47 "[I", |
|
48 "[[[Ljava/lang/Object;", |
|
49 "[[B" |
48 }; |
50 }; |
49 |
51 |
50 public static void main(String[] args) throws Exception { |
52 public static void main(String[] args) throws Exception { |
51 JarBuilder.build("arrayTestHelper", "ArrayTestHelper"); |
53 JarBuilder.build("arrayTestHelper", "ArrayTestHelper"); |
52 |
54 |
54 JarBuilder.build(true, "WhiteBox", "sun/hotspot/WhiteBox"); |
56 JarBuilder.build(true, "WhiteBox", "sun/hotspot/WhiteBox"); |
55 String whiteBoxJar = TestCommon.getTestJar("WhiteBox.jar"); |
57 String whiteBoxJar = TestCommon.getTestJar("WhiteBox.jar"); |
56 String bootClassPath = "-Xbootclasspath/a:" + whiteBoxJar; |
58 String bootClassPath = "-Xbootclasspath/a:" + whiteBoxJar; |
57 |
59 |
58 // create an archive containing array classes |
60 // create an archive containing array classes |
59 TestCommon.dump(appJar, TestCommon.list(arrayClasses), bootClassPath, "-verbose:class"); |
61 OutputAnalyzer output = TestCommon.dump(appJar, TestCommon.list(arrayClasses), bootClassPath, "-verbose:class"); |
|
62 // we currently don't support array classes during CDS dump |
|
63 output.shouldContain("Preload Warning: Cannot find [Ljava/lang/Comparable;") |
|
64 .shouldContain("Preload Warning: Cannot find [I") |
|
65 .shouldContain("Preload Warning: Cannot find [[[Ljava/lang/Object;") |
|
66 .shouldContain("Preload Warning: Cannot find [[B"); |
60 |
67 |
61 List<String> argsList = new ArrayList<String>(); |
68 List<String> argsList = new ArrayList<String>(); |
62 argsList.add("-XX:+UnlockDiagnosticVMOptions"); |
69 argsList.add("-XX:+UnlockDiagnosticVMOptions"); |
63 argsList.add("-XX:+WhiteBoxAPI"); |
70 argsList.add("-XX:+WhiteBoxAPI"); |
64 argsList.add("-cp"); |
71 argsList.add("-cp"); |
65 argsList.add(appJar); |
72 argsList.add(appJar); |
66 argsList.add(bootClassPath); |
73 argsList.add(bootClassPath); |
67 argsList.add("-verbose:class"); |
74 argsList.add("-verbose:class"); |
68 argsList.add("ArrayTestHelper"); |
75 argsList.add("ArrayTestHelper"); |
69 // the following are input args to the ArrayTestHelper. |
76 // the following are input args to the ArrayTestHelper. |
70 for (int i = 0; i < arrayClasses.length; i++) { |
77 // skip checking array classes during run time |
|
78 for (int i = 0; i < 1; i++) { |
71 argsList.add(arrayClasses[i]); |
79 argsList.add(arrayClasses[i]); |
72 } |
80 } |
73 String[] opts = new String[argsList.size()]; |
81 String[] opts = new String[argsList.size()]; |
74 opts = argsList.toArray(opts); |
82 opts = argsList.toArray(opts); |
75 OutputAnalyzer output = TestCommon.execCommon(opts); |
83 output = TestCommon.execCommon(opts); |
76 TestCommon.checkExec(output); |
84 TestCommon.checkExec(output); |
77 } |
85 } |
78 } |
86 } |