author | alanb |
Fri, 10 Feb 2017 09:03:55 +0000 | |
changeset 43665 | 4bb003cad9b9 |
parent 43446 | 4f9ac7ab99d9 |
child 44520 | 0553e129e0ec |
child 46322 | 25836096c89d |
permissions | -rw-r--r-- |
36508 | 1 |
/* |
43665
4bb003cad9b9
8173393: Module system implementation refresh (2/2017)
alanb
parents:
43446
diff
changeset
|
2 |
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. |
36508 | 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 |
* @test |
|
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
36508
diff
changeset
|
26 |
* @modules java.base/jdk.internal.misc |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40020
diff
changeset
|
27 |
* @library /test/lib .. |
36508 | 28 |
* @build sun.hotspot.WhiteBox |
29 |
* @compile/module=java.base java/lang/reflect/ModuleHelper.java |
|
30 |
* @run main ClassFileInstaller sun.hotspot.WhiteBox |
|
31 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
|
32 |
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI JVMDefineModule |
|
33 |
*/ |
|
34 |
||
35 |
import static jdk.test.lib.Asserts.*; |
|
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
36 |
import java.sql.Time; |
36508 | 37 |
|
38 |
public class JVMDefineModule { |
|
39 |
||
40 |
public static void main(String args[]) throws Throwable { |
|
41 |
MyClassLoader cl = new MyClassLoader(); |
|
42 |
Object m; |
|
43 |
||
44 |
// NULL classloader argument, expect success |
|
45 |
m = ModuleHelper.ModuleObject("mymodule", null, new String[] { "mypackage" }); |
|
46 |
assertNotNull(m, "Module should not be null"); |
|
47 |
ModuleHelper.DefineModule(m, "9.0", "mymodule/here", new String[] { "mypackage" }); |
|
48 |
||
49 |
/* Invalid test, won't compile. |
|
50 |
// Invalid classloader argument, expect an IAE |
|
51 |
try { |
|
43665
4bb003cad9b9
8173393: Module system implementation refresh (2/2017)
alanb
parents:
43446
diff
changeset
|
52 |
m = ModuleHelper.ModuleObject("mymodule_one", new Object(), new String[] { "mypackage1" }); |
36508 | 53 |
ModuleHelper.DefineModule(m, "9.0", "mymodule/here", new String[] { "mypackage1" }); |
54 |
throw new RuntimeException("Failed to get expected IAE for bad loader"); |
|
55 |
} catch(IllegalArgumentException e) { |
|
56 |
// Expected |
|
57 |
} |
|
58 |
*/ |
|
59 |
||
60 |
// NULL package argument, should not throw an exception |
|
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
61 |
m = ModuleHelper.ModuleObject("mymoduleTwo", cl, new String[] { "nullpkg" }); |
36508 | 62 |
assertNotNull(m, "Module should not be null"); |
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
63 |
ModuleHelper.DefineModule(m, "9.0", "mymoduleTwo/here", null); |
36508 | 64 |
|
65 |
// Null module argument, expect an NPE |
|
66 |
try { |
|
67 |
ModuleHelper.DefineModule(null, "9.0", "mymodule/here", new String[] { "mypackage1" }); |
|
68 |
throw new RuntimeException("Failed to get expected NPE for null module"); |
|
69 |
} catch(NullPointerException e) { |
|
70 |
if (!e.getMessage().contains("Null module object")) { |
|
71 |
throw new RuntimeException("Failed to get expected IAE message for null module: " + e.getMessage()); |
|
72 |
} |
|
73 |
// Expected |
|
74 |
} |
|
75 |
||
76 |
// Invalid module argument, expect an IAE |
|
77 |
try { |
|
78 |
ModuleHelper.DefineModule(new Object(), "9.0", "mymodule/here", new String[] { "mypackage1" }); |
|
79 |
throw new RuntimeException("Failed to get expected IAE or NPE for bad module"); |
|
80 |
} catch(IllegalArgumentException e) { |
|
40020
20738e6bef83
8160487: JVM should validate a module by checking for an instance of java.lang.reflect.Module
lfoltan
parents:
38152
diff
changeset
|
81 |
if (!e.getMessage().contains("module is not an instance of type java.lang.reflect.Module")) { |
36508 | 82 |
throw new RuntimeException("Failed to get expected IAE message for bad module: " + e.getMessage()); |
83 |
} |
|
84 |
} |
|
85 |
||
86 |
// NULL module name, expect an IAE or NPE |
|
87 |
try { |
|
88 |
m = ModuleHelper.ModuleObject(null, cl, new String[] { "mypackage2" }); |
|
89 |
ModuleHelper.DefineModule(m, "9.0", "mymodule/here", new String[] { "mypackage2" }); |
|
90 |
throw new RuntimeException("Failed to get expected NPE for NULL module"); |
|
91 |
} catch(IllegalArgumentException e) { |
|
92 |
// Expected |
|
93 |
} catch(NullPointerException e) { |
|
94 |
// Expected |
|
95 |
} |
|
96 |
||
97 |
// module name is java.base, expect an IAE |
|
98 |
m = ModuleHelper.ModuleObject("java.base", cl, new String[] { "mypackage3" }); |
|
99 |
try { |
|
100 |
ModuleHelper.DefineModule(m, "9.0", "mymodule/here", new String[] { "mypackage3" }); |
|
101 |
throw new RuntimeException("Failed to get expected IAE for java.base, not defined with boot class loader"); |
|
102 |
} catch(IllegalArgumentException e) { |
|
103 |
if (!e.getMessage().contains("Class loader must be the boot class loader")) { |
|
104 |
throw new RuntimeException("Failed to get expected IAE message for java.base: " + e.getMessage()); |
|
105 |
} |
|
106 |
} |
|
107 |
||
108 |
// Duplicates in package list, expect an IAE |
|
109 |
m = ModuleHelper.ModuleObject("module.x", cl, new String[] { "mypackage4", "mypackage5" }); |
|
110 |
try { |
|
111 |
ModuleHelper.DefineModule(m, "9.0", "mymodule/here", new String[] { "mypackage4", "mypackage5", "mypackage4" }); |
|
112 |
throw new RuntimeException("Failed to get IAE for duplicate packages"); |
|
113 |
} catch(IllegalArgumentException e) { |
|
114 |
if (!e.getMessage().contains("Duplicate package name")) { |
|
115 |
throw new RuntimeException("Failed to get expected IAE message for duplicate package: " + e.getMessage()); |
|
116 |
} |
|
117 |
} |
|
118 |
||
119 |
// Empty entry in package list, expect an IAE |
|
120 |
m = ModuleHelper.ModuleObject("module.y", cl, new String[] { "mypackageX", "mypackageY" }); |
|
121 |
try { |
|
122 |
ModuleHelper.DefineModule(m, "9.0", "mymodule/here", new String[] { "mypackageX", "", "mypackageY" }); |
|
123 |
throw new RuntimeException("Failed to get IAE for empty package"); |
|
124 |
} catch(IllegalArgumentException e) { |
|
125 |
if (!e.getMessage().contains("Invalid package name")) { |
|
126 |
throw new RuntimeException("Failed to get expected IAE message empty package entry: " + e.getMessage()); |
|
127 |
} |
|
128 |
} |
|
129 |
||
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42630
diff
changeset
|
130 |
// Duplicate module name, expect an ISE |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42630
diff
changeset
|
131 |
m = ModuleHelper.ModuleObject("Module_A", cl, new String[] { "mypackage6" }); |
36508 | 132 |
assertNotNull(m, "Module should not be null"); |
133 |
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "mypackage6" }); |
|
134 |
try { |
|
135 |
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "mypackage6a" }); |
|
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42630
diff
changeset
|
136 |
throw new RuntimeException("Failed to get ISE for duplicate module"); |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42630
diff
changeset
|
137 |
} catch(IllegalStateException e) { |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42630
diff
changeset
|
138 |
if (!e.getMessage().contains("Module Module_A is already defined")) { |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42630
diff
changeset
|
139 |
throw new RuntimeException("Failed to get expected ISE message for duplicate module: " + e.getMessage()); |
36508 | 140 |
} |
141 |
} |
|
142 |
||
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42630
diff
changeset
|
143 |
// Package is already defined for class loader, expect an ISE |
36508 | 144 |
m = ModuleHelper.ModuleObject("dupl.pkg.module", cl, new String[] { "mypackage6b" }); |
145 |
try { |
|
146 |
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "mypackage6" }); |
|
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42630
diff
changeset
|
147 |
throw new RuntimeException("Failed to get ISE for existing package"); |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42630
diff
changeset
|
148 |
} catch(IllegalStateException e) { |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42630
diff
changeset
|
149 |
if (!e.getMessage().contains("Package mypackage6 for module dupl.pkg.module is already in another module, Module_A, defined to the class loader")) { |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42630
diff
changeset
|
150 |
throw new RuntimeException("Failed to get expected ISE message for duplicate package: " + e.getMessage()); |
36508 | 151 |
} |
152 |
} |
|
153 |
||
154 |
// Empty module name, expect an IAE |
|
155 |
try { |
|
156 |
m = ModuleHelper.ModuleObject("", cl, new String[] { "mypackage8" }); |
|
157 |
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "mypackage8" }); |
|
158 |
throw new RuntimeException("Failed to get expected IAE for empty module name"); |
|
159 |
} catch(IllegalArgumentException e) { |
|
160 |
// Expected |
|
161 |
} |
|
162 |
||
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
163 |
// Module name with ';', not allowed in java source |
36508 | 164 |
try { |
165 |
m = ModuleHelper.ModuleObject("bad;name", cl, new String[] { "mypackage9" }); |
|
166 |
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "mypackage9" }); |
|
167 |
throw new RuntimeException("Failed to get expected IAE for bad;name"); |
|
168 |
} catch(IllegalArgumentException e) { |
|
169 |
// Expected |
|
170 |
} |
|
171 |
||
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
172 |
// Module name with leading dot, not allowed in java source |
36508 | 173 |
try { |
174 |
m = ModuleHelper.ModuleObject(".leadingdot", cl, new String[] { "mypackage9a" }); |
|
175 |
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "mypackage9a" }); |
|
176 |
throw new RuntimeException("Failed to get expected IAE for .leadingdot"); |
|
177 |
} catch(IllegalArgumentException e) { |
|
178 |
// Expected |
|
179 |
} |
|
180 |
||
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
181 |
// Module name with trailing dot, not allowed in java source |
36508 | 182 |
try { |
183 |
m = ModuleHelper.ModuleObject("trailingdot.", cl, new String[] { "mypackage9b" }); |
|
184 |
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "mypackage9b" }); |
|
185 |
throw new RuntimeException("Failed to get expected IAE for trailingdot."); |
|
186 |
} catch(IllegalArgumentException e) { |
|
187 |
// Expected |
|
188 |
} |
|
189 |
||
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
190 |
// Module name with consecutive dots, not allowed in java source |
36508 | 191 |
try { |
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
192 |
m = ModuleHelper.ModuleObject("trailingdot.", cl, new String[] { "mypackage9b" }); |
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
193 |
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "mypackage9b" }); |
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
194 |
throw new RuntimeException("Failed to get expected IAE for trailingdot."); |
36508 | 195 |
} catch(IllegalArgumentException e) { |
196 |
// Expected |
|
197 |
} |
|
198 |
||
199 |
// module name with multiple dots, should be okay |
|
200 |
m = ModuleHelper.ModuleObject("more.than.one.dat", cl, new String[] { "mypackage9d" }); |
|
201 |
assertNotNull(m, "Module should not be null"); |
|
202 |
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "mypackage9d" }); |
|
203 |
||
204 |
// Zero length package list, should be okay |
|
205 |
m = ModuleHelper.ModuleObject("zero.packages", cl, new String[] { }); |
|
206 |
assertNotNull(m, "Module should not be null"); |
|
207 |
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { }); |
|
208 |
||
209 |
// Invalid package name, expect an IAE |
|
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
210 |
m = ModuleHelper.ModuleObject("moduleFive", cl, new String[] { "your.package" }); |
36508 | 211 |
try { |
212 |
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "your.package" }); |
|
213 |
throw new RuntimeException("Failed to get expected IAE for your.package"); |
|
214 |
} catch(IllegalArgumentException e) { |
|
215 |
if (!e.getMessage().contains("Invalid package name")) { |
|
216 |
throw new RuntimeException("Failed to get expected IAE message for bad package name: " + e.getMessage()); |
|
217 |
} |
|
218 |
} |
|
219 |
||
220 |
// Invalid package name, expect an IAE |
|
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
221 |
m = ModuleHelper.ModuleObject("moduleSix", cl, new String[] { "foo" }); // Name irrelevant |
36508 | 222 |
try { |
223 |
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { ";your/package" }); |
|
224 |
throw new RuntimeException("Failed to get expected IAE for ;your.package"); |
|
225 |
} catch(IllegalArgumentException e) { |
|
226 |
if (!e.getMessage().contains("Invalid package name")) { |
|
227 |
throw new RuntimeException("Failed to get expected IAE message for bad package name: " + e.getMessage()); |
|
228 |
} |
|
229 |
} |
|
230 |
||
231 |
// Invalid package name, expect an IAE |
|
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
232 |
m = ModuleHelper.ModuleObject("moduleSeven", cl, new String[] { "foo" }); // Name irrelevant |
36508 | 233 |
try { |
234 |
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "7[743" }); |
|
235 |
throw new RuntimeException("Failed to get expected IAE for package 7[743"); |
|
236 |
} catch(IllegalArgumentException e) { |
|
237 |
if (!e.getMessage().contains("Invalid package name")) { |
|
238 |
throw new RuntimeException("Failed to get expected IAE message for bad package name: " + e.getMessage()); |
|
239 |
} |
|
240 |
} |
|
241 |
||
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
242 |
// Package named "java" defined to a class loader other than the boot or platform class loader, expect an IAE |
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
243 |
m = ModuleHelper.ModuleObject("modulejavapkgOne", cl, new String[] { "java/foo" }); |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
244 |
try { |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
245 |
// module m is defined to an instance of MyClassLoader class loader |
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
246 |
ModuleHelper.DefineModule(m, "9.0", "modulejavapkgOne", new String[] { "java/foo" }); |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
247 |
throw new RuntimeException("Failed to get expected IAE for package java/foo"); |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
248 |
} catch(IllegalArgumentException e) { |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
249 |
if (!e.getMessage().contains("prohibited package name")) { |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
250 |
throw new RuntimeException("Failed to get expected IAE message for prohibited package name: " + e.getMessage()); |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
251 |
} |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
252 |
} |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
253 |
|
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
254 |
// Package named "javabar" defined to a class loader other than the boot or platform class loader, should be ok |
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
255 |
m = ModuleHelper.ModuleObject("modulejavapkgTwo", cl, new String[] { "javabar" }); |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
256 |
assertNotNull(m, "Module should not be null"); |
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
257 |
ModuleHelper.DefineModule(m, "9.0", "modulejavapkgTwo", new String[] { "javabar" }); |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
258 |
|
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
259 |
// Package named "java" defined to the boot class loader, should be ok |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
260 |
// m's type is a java.lang.Object, module is java.base |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
261 |
// java.base module is defined to the boot loader |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
262 |
ClassLoader boot_loader = m.getClass().getClassLoader(); |
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
263 |
m = ModuleHelper.ModuleObject("modulejavapkgThree", boot_loader, new String[] { "java/foo" }); |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
264 |
assertNotNull(m, "Module should not be null"); |
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
265 |
ModuleHelper.DefineModule(m, "9.0", "modulejavapkgThree", new String[] { "java/foo" }); |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
266 |
|
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
267 |
// Package named "java" defined to the platform class loader, should be ok |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
268 |
// java.sql module defined to the platform class loader. |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
269 |
java.sql.Time jst = new java.sql.Time(45 * 1000); |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
270 |
ClassLoader platform_loader = jst.getClass().getClassLoader(); |
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
271 |
m = ModuleHelper.ModuleObject("modulejavapkgFour", platform_loader, new String[] { "java/foo" }); |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
272 |
assertNotNull(m, "Module should not be null"); |
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
273 |
ModuleHelper.DefineModule(m, "9.0", "modulejavapkgFour", new String[] { "java/foo" }); |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
40631
diff
changeset
|
274 |
|
36508 | 275 |
// module version that is null, should be okay |
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
276 |
m = ModuleHelper.ModuleObject("moduleEight", cl, new String[] { "a_package_8" }); |
36508 | 277 |
assertNotNull(m, "Module should not be null"); |
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
278 |
ModuleHelper.DefineModule(m, null, "moduleEight/here", new String[] { "a_package_8" }); |
36508 | 279 |
|
280 |
// module version that is "", should be okay |
|
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
281 |
m = ModuleHelper.ModuleObject("moduleNine", cl, new String[] { "a_package_9" }); |
36508 | 282 |
assertNotNull(m, "Module should not be null"); |
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
283 |
ModuleHelper.DefineModule(m, "", "moduleNine/here", new String[] { "a_package_9" }); |
36508 | 284 |
|
285 |
// module location that is null, should be okay |
|
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
286 |
m = ModuleHelper.ModuleObject("moduleTen", cl, new String[] { "a_package_10" }); |
36508 | 287 |
assertNotNull(m, "Module should not be null"); |
288 |
ModuleHelper.DefineModule(m, "9.0", null, new String[] { "a_package_10" }); |
|
289 |
||
290 |
// module location that is "", should be okay |
|
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
291 |
m = ModuleHelper.ModuleObject("moduleEleven", cl, new String[] { "a_package_11" }); |
36508 | 292 |
assertNotNull(m, "Module should not be null"); |
293 |
ModuleHelper.DefineModule(m, "9.0", "", new String[] { "a_package_11" }); |
|
294 |
} |
|
295 |
||
296 |
static class MyClassLoader extends ClassLoader { } |
|
297 |
} |