author | jwilhelm |
Thu, 22 Jun 2017 00:51:07 +0200 | |
changeset 46554 | aa1cfd918c4f |
parent 46463 | 4bd2ca84df7a |
child 46560 | 388aa8d67c80 |
permissions | -rw-r--r-- |
36508 | 1 |
/* |
43471
bfb383279a16
8171971: Fix timing bug in JVM management of package export lists
hseigel
parents:
43466
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 |
#include "precompiled.hpp" |
|
26 |
#include "classfile/classFileParser.hpp" |
|
27 |
#include "classfile/classLoader.hpp" |
|
28 |
#include "classfile/classLoaderData.inline.hpp" |
|
29 |
#include "classfile/javaAssertions.hpp" |
|
30 |
#include "classfile/javaClasses.hpp" |
|
31 |
#include "classfile/javaClasses.inline.hpp" |
|
32 |
#include "classfile/moduleEntry.hpp" |
|
33 |
#include "classfile/modules.hpp" |
|
34 |
#include "classfile/packageEntry.hpp" |
|
35 |
#include "classfile/stringTable.hpp" |
|
36 |
#include "classfile/symbolTable.hpp" |
|
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
37 |
#include "classfile/systemDictionary.hpp" |
36508 | 38 |
#include "classfile/vmSymbols.hpp" |
39 |
#include "logging/log.hpp" |
|
37248 | 40 |
#include "memory/resourceArea.hpp" |
36508 | 41 |
#include "oops/instanceKlass.hpp" |
42 |
#include "runtime/arguments.hpp" |
|
43 |
#include "runtime/handles.inline.hpp" |
|
44 |
#include "runtime/javaCalls.hpp" |
|
45 |
#include "runtime/reflection.hpp" |
|
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
46 |
#include "utilities/stringUtils.hpp" |
36508 | 47 |
#include "utilities/utf8.hpp" |
48 |
||
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
49 |
static bool verify_module_name(const char *module_name) { |
36508 | 50 |
if (module_name == NULL) return false; |
51 |
int len = (int)strlen(module_name); |
|
42630
ae91fbc4b59f
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42307
diff
changeset
|
52 |
return (len > 0 && len <= Symbol::max_length()); |
36508 | 53 |
} |
54 |
||
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
55 |
bool Modules::verify_package_name(const char* package_name) { |
36508 | 56 |
if (package_name == NULL) return false; |
57 |
int len = (int)strlen(package_name); |
|
58 |
return (len > 0 && len <= Symbol::max_length() && |
|
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
59 |
UTF8::is_legal_utf8((const unsigned char *)package_name, len, false) && |
36508 | 60 |
ClassFileParser::verify_unqualified_name(package_name, len, |
61 |
ClassFileParser::LegalClass)); |
|
62 |
} |
|
63 |
||
64 |
static char* get_module_name(oop module, TRAPS) { |
|
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
65 |
oop name_oop = java_lang_Module::name(module); |
36508 | 66 |
if (name_oop == NULL) { |
67 |
THROW_MSG_NULL(vmSymbols::java_lang_NullPointerException(), "Null module name"); |
|
68 |
} |
|
69 |
char* module_name = java_lang_String::as_utf8_string(name_oop); |
|
70 |
if (!verify_module_name(module_name)) { |
|
71 |
THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(), |
|
72 |
err_msg("Invalid module name: %s", |
|
73 |
module_name != NULL ? module_name : "NULL")); |
|
74 |
} |
|
75 |
return module_name; |
|
76 |
} |
|
77 |
||
78 |
static const char* get_module_version(jstring version) { |
|
79 |
if (version == NULL) { |
|
80 |
return NULL; |
|
81 |
} |
|
82 |
return java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(version)); |
|
83 |
} |
|
84 |
||
85 |
static ModuleEntryTable* get_module_entry_table(Handle h_loader, TRAPS) { |
|
86 |
// This code can be called during start-up, before the classLoader's classLoader data got |
|
87 |
// created. So, call register_loader() to make sure the classLoader data gets created. |
|
88 |
ClassLoaderData *loader_cld = SystemDictionary::register_loader(h_loader, CHECK_NULL); |
|
89 |
return loader_cld->modules(); |
|
90 |
} |
|
91 |
||
92 |
static PackageEntryTable* get_package_entry_table(Handle h_loader, TRAPS) { |
|
93 |
// This code can be called during start-up, before the classLoader's classLoader data got |
|
94 |
// created. So, call register_loader() to make sure the classLoader data gets created. |
|
95 |
ClassLoaderData *loader_cld = SystemDictionary::register_loader(h_loader, CHECK_NULL); |
|
96 |
return loader_cld->packages(); |
|
97 |
} |
|
98 |
||
99 |
static ModuleEntry* get_module_entry(jobject module, TRAPS) { |
|
100 |
Handle module_h(THREAD, JNIHandles::resolve(module)); |
|
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
101 |
if (!java_lang_Module::is_instance(module_h())) { |
40020
20738e6bef83
8160487: JVM should validate a module by checking for an instance of java.lang.reflect.Module
lfoltan
parents:
40013
diff
changeset
|
102 |
THROW_MSG_NULL(vmSymbols::java_lang_IllegalArgumentException(), |
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
103 |
"module is not an instance of type java.lang.Module"); |
36508 | 104 |
} |
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
105 |
return java_lang_Module::module_entry(module_h(), CHECK_NULL); |
36508 | 106 |
} |
107 |
||
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
108 |
static PackageEntry* get_package_entry(ModuleEntry* module_entry, const char* package_name, TRAPS) { |
36508 | 109 |
ResourceMark rm(THREAD); |
110 |
if (package_name == NULL) return NULL; |
|
111 |
TempNewSymbol pkg_symbol = SymbolTable::new_symbol(package_name, CHECK_NULL); |
|
39616
f82b1f888578
8159262: Walking PackageEntry Export and ModuleEntry Reads Must Occur Only When Neccessary And Wait Until ClassLoader's Aliveness Determined
lfoltan
parents:
39290
diff
changeset
|
112 |
PackageEntryTable* package_entry_table = module_entry->loader_data()->packages(); |
36508 | 113 |
assert(package_entry_table != NULL, "Unexpected null package entry table"); |
114 |
return package_entry_table->lookup_only(pkg_symbol); |
|
115 |
} |
|
116 |
||
117 |
static PackageEntry* get_package_entry_by_name(Symbol* package, |
|
118 |
Handle h_loader, |
|
119 |
TRAPS) { |
|
120 |
if (package != NULL) { |
|
121 |
ResourceMark rm(THREAD); |
|
122 |
if (Modules::verify_package_name(package->as_C_string())) { |
|
123 |
PackageEntryTable* const package_entry_table = |
|
124 |
get_package_entry_table(h_loader, CHECK_NULL); |
|
125 |
assert(package_entry_table != NULL, "Unexpected null package entry table"); |
|
126 |
return package_entry_table->lookup_only(package); |
|
127 |
} |
|
128 |
} |
|
129 |
return NULL; |
|
130 |
} |
|
131 |
||
132 |
bool Modules::is_package_defined(Symbol* package, Handle h_loader, TRAPS) { |
|
133 |
PackageEntry* res = get_package_entry_by_name(package, h_loader, CHECK_false); |
|
134 |
return res != NULL; |
|
135 |
} |
|
136 |
||
137 |
static void define_javabase_module(jobject module, jstring version, |
|
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
138 |
jstring location, const char* const* packages, |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
139 |
jsize num_packages, TRAPS) { |
36508 | 140 |
ResourceMark rm(THREAD); |
141 |
||
142 |
Handle module_handle(THREAD, JNIHandles::resolve(module)); |
|
143 |
||
144 |
// Obtain java.base's module version |
|
145 |
const char* module_version = get_module_version(version); |
|
146 |
TempNewSymbol version_symbol; |
|
147 |
if (module_version != NULL) { |
|
148 |
version_symbol = SymbolTable::new_symbol(module_version, CHECK); |
|
149 |
} else { |
|
150 |
version_symbol = NULL; |
|
151 |
} |
|
152 |
||
153 |
// Obtain java.base's location |
|
154 |
const char* module_location = NULL; |
|
155 |
TempNewSymbol location_symbol = NULL; |
|
156 |
if (location != NULL) { |
|
157 |
module_location = |
|
158 |
java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(location)); |
|
159 |
if (module_location != NULL) { |
|
160 |
location_symbol = SymbolTable::new_symbol(module_location, CHECK); |
|
161 |
} |
|
162 |
} |
|
163 |
||
164 |
||
46322
25836096c89d
8172514: Stop checking for duplicate packages in the JVM_DefineModule() package list
hseigel
parents:
46296
diff
changeset
|
165 |
// Check that the packages are syntactically ok. |
36508 | 166 |
GrowableArray<Symbol*>* pkg_list = new GrowableArray<Symbol*>(num_packages); |
167 |
for (int x = 0; x < num_packages; x++) { |
|
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
168 |
const char *package_name = packages[x]; |
36508 | 169 |
if (!Modules::verify_package_name(package_name)) { |
170 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
42636
aafc434ba580
8169734: Update uses of string "java.base" to macro
rprotacio
parents:
41691
diff
changeset
|
171 |
err_msg("Invalid package name: %s for module: " JAVA_BASE_NAME, package_name)); |
36508 | 172 |
} |
173 |
Symbol* pkg_symbol = SymbolTable::new_symbol(package_name, CHECK); |
|
46322
25836096c89d
8172514: Stop checking for duplicate packages in the JVM_DefineModule() package list
hseigel
parents:
46296
diff
changeset
|
174 |
pkg_list->append(pkg_symbol); |
36508 | 175 |
} |
176 |
||
177 |
// Validate java_base's loader is the boot loader. |
|
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
178 |
oop loader = java_lang_Module::loader(module_handle()); |
36508 | 179 |
if (loader != NULL) { |
180 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
181 |
"Class loader must be the boot class loader"); |
|
182 |
} |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42656
diff
changeset
|
183 |
Handle h_loader(THREAD, loader); |
36508 | 184 |
|
185 |
// Ensure the boot loader's PackageEntryTable has been created |
|
186 |
PackageEntryTable* package_table = get_package_entry_table(h_loader, CHECK); |
|
187 |
assert(pkg_list->length() == 0 || package_table != NULL, "Bad package_table"); |
|
188 |
||
189 |
// Ensure java.base's ModuleEntry has been created |
|
42636
aafc434ba580
8169734: Update uses of string "java.base" to macro
rprotacio
parents:
41691
diff
changeset
|
190 |
assert(ModuleEntryTable::javabase_moduleEntry() != NULL, "No ModuleEntry for " JAVA_BASE_NAME); |
36508 | 191 |
|
38732
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
192 |
bool duplicate_javabase = false; |
36508 | 193 |
{ |
194 |
MutexLocker m1(Module_lock, THREAD); |
|
195 |
||
38014
8731fa11f766
8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents:
37248
diff
changeset
|
196 |
if (ModuleEntryTable::javabase_defined()) { |
38732
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
197 |
duplicate_javabase = true; |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
198 |
} else { |
38014
8731fa11f766
8152949: Jigsaw crash when Klass in _fixup_module_field_list is unloaded
lfoltan
parents:
37248
diff
changeset
|
199 |
|
38732
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
200 |
// Verify that all java.base packages created during bootstrapping are in |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
201 |
// pkg_list. If any are not in pkg_list, than a non-java.base class was |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
202 |
// loaded erroneously pre java.base module definition. |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
203 |
package_table->verify_javabase_packages(pkg_list); |
36508 | 204 |
|
38732
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
205 |
// loop through and add any new packages for java.base |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
206 |
PackageEntry* pkg; |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
207 |
for (int x = 0; x < pkg_list->length(); x++) { |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
208 |
// Some of java.base's packages were added early in bootstrapping, ignore duplicates. |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
209 |
if (package_table->lookup_only(pkg_list->at(x)) == NULL) { |
41183
207b92e69457
8163406: The fixup_module_list must be protected by Module_lock when inserting new entries
lfoltan
parents:
40020
diff
changeset
|
210 |
pkg = package_table->locked_create_entry_or_null(pkg_list->at(x), ModuleEntryTable::javabase_moduleEntry()); |
42636
aafc434ba580
8169734: Update uses of string "java.base" to macro
rprotacio
parents:
41691
diff
changeset
|
211 |
assert(pkg != NULL, "Unable to create a " JAVA_BASE_NAME " package entry"); |
38732
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
212 |
} |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
213 |
// Unable to have a GrowableArray of TempNewSymbol. Must decrement the refcount of |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
214 |
// the Symbol* that was created above for each package. The refcount was incremented |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
215 |
// by SymbolTable::new_symbol and as well by the PackageEntry creation. |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
216 |
pkg_list->at(x)->decrement_refcount(); |
36508 | 217 |
} |
38732
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
218 |
|
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
219 |
// Finish defining java.base's ModuleEntry |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
220 |
ModuleEntryTable::finalize_javabase(module_handle, version_symbol, location_symbol); |
36508 | 221 |
} |
38732
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
222 |
} |
bb77e0dcc7e5
8158060: BasicLayerTest causes fatal error: Thread holding lock at safepoint that vm can block on: Module_lock
hseigel
parents:
38207
diff
changeset
|
223 |
if (duplicate_javabase) { |
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
224 |
THROW_MSG(vmSymbols::java_lang_InternalError(), |
42636
aafc434ba580
8169734: Update uses of string "java.base" to macro
rprotacio
parents:
41691
diff
changeset
|
225 |
"Module " JAVA_BASE_NAME " is already defined"); |
36508 | 226 |
} |
227 |
||
41691
1be281ee5de4
8166364: fatal error: acquiring lock DirtyCardQ_CBL_mon/16 out of order with lock Module_lock/6 -- possible deadlock
hseigel
parents:
41183
diff
changeset
|
228 |
// Only the thread that actually defined the base module will get here, |
1be281ee5de4
8166364: fatal error: acquiring lock DirtyCardQ_CBL_mon/16 out of order with lock Module_lock/6 -- possible deadlock
hseigel
parents:
41183
diff
changeset
|
229 |
// so no locking is needed. |
1be281ee5de4
8166364: fatal error: acquiring lock DirtyCardQ_CBL_mon/16 out of order with lock Module_lock/6 -- possible deadlock
hseigel
parents:
41183
diff
changeset
|
230 |
|
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
231 |
// Patch any previously loaded class's module field with java.base's java.lang.Module. |
41691
1be281ee5de4
8166364: fatal error: acquiring lock DirtyCardQ_CBL_mon/16 out of order with lock Module_lock/6 -- possible deadlock
hseigel
parents:
41183
diff
changeset
|
232 |
ModuleEntryTable::patch_javabase_entries(module_handle); |
1be281ee5de4
8166364: fatal error: acquiring lock DirtyCardQ_CBL_mon/16 out of order with lock Module_lock/6 -- possible deadlock
hseigel
parents:
41183
diff
changeset
|
233 |
|
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
234 |
log_info(module, load)(JAVA_BASE_NAME " location: %s", |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
235 |
module_location != NULL ? module_location : "NULL"); |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
236 |
log_debug(module)("define_javabase_module(): Definition of module: " |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
237 |
JAVA_BASE_NAME ", version: %s, location: %s, package #: %d", |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
238 |
module_version != NULL ? module_version : "NULL", |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
239 |
module_location != NULL ? module_location : "NULL", |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
240 |
pkg_list->length()); |
36508 | 241 |
|
242 |
// packages defined to java.base |
|
46458 | 243 |
if (log_is_enabled(Trace, module)) { |
46404
ae62ba99a1a7
8165896: Use "open" flag from JVM_DefineModule to export all module packages
rprotacio
parents:
46388
diff
changeset
|
244 |
for (int x = 0; x < pkg_list->length(); x++) { |
46458 | 245 |
log_trace(module)("define_javabase_module(): creation of package %s for module " JAVA_BASE_NAME, |
246 |
(pkg_list->at(x))->as_C_string()); |
|
46404
ae62ba99a1a7
8165896: Use "open" flag from JVM_DefineModule to export all module packages
rprotacio
parents:
46388
diff
changeset
|
247 |
} |
36508 | 248 |
} |
249 |
} |
|
250 |
||
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
251 |
// Caller needs ResourceMark. |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
252 |
void throw_dup_pkg_exception(const char* module_name, PackageEntry* package, TRAPS) { |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
253 |
const char* package_name = package->name()->as_C_string(); |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
254 |
if (package->module()->is_named()) { |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
255 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
256 |
err_msg("Package %s for module %s is already in another module, %s, defined to the class loader", |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
257 |
package_name, module_name, package->module()->name()->as_C_string())); |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
258 |
} else { |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
259 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
260 |
err_msg("Package %s for module %s is already in the unnamed module defined to the class loader", |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
261 |
package_name, module_name)); |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
262 |
} |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
263 |
} |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
264 |
|
46404
ae62ba99a1a7
8165896: Use "open" flag from JVM_DefineModule to export all module packages
rprotacio
parents:
46388
diff
changeset
|
265 |
void Modules::define_module(jobject module, jboolean is_open, jstring version, |
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
266 |
jstring location, const char* const* packages, |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
267 |
jsize num_packages, TRAPS) { |
36508 | 268 |
ResourceMark rm(THREAD); |
269 |
||
270 |
if (module == NULL) { |
|
271 |
THROW_MSG(vmSymbols::java_lang_NullPointerException(), "Null module object"); |
|
272 |
} |
|
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
273 |
|
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
274 |
if (num_packages < 0) { |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
275 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
276 |
"num_packages must be >= 0"); |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
277 |
} |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
278 |
|
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
279 |
if (packages == NULL && num_packages > 0) { |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
280 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
281 |
"num_packages should be zero if packages is null"); |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
282 |
} |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
283 |
|
36508 | 284 |
Handle module_handle(THREAD, JNIHandles::resolve(module)); |
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
285 |
if (!java_lang_Module::is_instance(module_handle())) { |
36508 | 286 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
287 |
"module is not an instance of type java.lang.Module"); |
36508 | 288 |
} |
289 |
||
290 |
char* module_name = get_module_name(module_handle(), CHECK); |
|
291 |
if (module_name == NULL) { |
|
292 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
293 |
"Module name cannot be null"); |
|
294 |
} |
|
295 |
||
296 |
// Special handling of java.base definition |
|
42636
aafc434ba580
8169734: Update uses of string "java.base" to macro
rprotacio
parents:
41691
diff
changeset
|
297 |
if (strcmp(module_name, JAVA_BASE_NAME) == 0) { |
46404
ae62ba99a1a7
8165896: Use "open" flag from JVM_DefineModule to export all module packages
rprotacio
parents:
46388
diff
changeset
|
298 |
assert(is_open == JNI_FALSE, "java.base module cannot be open"); |
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
299 |
define_javabase_module(module, version, location, packages, num_packages, CHECK); |
36508 | 300 |
return; |
301 |
} |
|
302 |
||
303 |
const char* module_version = get_module_version(version); |
|
304 |
||
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
305 |
oop loader = java_lang_Module::loader(module_handle()); |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
306 |
// Make sure loader is not the jdk.internal.reflect.DelegatingClassLoader. |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
307 |
if (loader != java_lang_ClassLoader::non_reflection_class_loader(loader)) { |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
308 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
309 |
"Class loader is an invalid delegating class loader"); |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
310 |
} |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
311 |
Handle h_loader = Handle(THREAD, loader); |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
312 |
|
36508 | 313 |
// Check that the list of packages has no duplicates and that the |
314 |
// packages are syntactically ok. |
|
315 |
GrowableArray<Symbol*>* pkg_list = new GrowableArray<Symbol*>(num_packages); |
|
316 |
for (int x = 0; x < num_packages; x++) { |
|
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
317 |
const char* package_name = packages[x]; |
36508 | 318 |
if (!verify_package_name(package_name)) { |
319 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
320 |
err_msg("Invalid package name: %s for module: %s", |
|
321 |
package_name, module_name)); |
|
322 |
} |
|
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
323 |
|
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
324 |
// Only modules defined to either the boot or platform class loader, can define a "java/" package. |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
325 |
if (!h_loader.is_null() && |
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42656
diff
changeset
|
326 |
!SystemDictionary::is_platform_class_loader(h_loader()) && |
44326
6c59cca7ff07
8174823: Module system implementation refresh (3/2017)
alanb
parents:
43471
diff
changeset
|
327 |
(strncmp(package_name, JAVAPKG, JAVAPKG_LEN) == 0 && |
6c59cca7ff07
8174823: Module system implementation refresh (3/2017)
alanb
parents:
43471
diff
changeset
|
328 |
(package_name[JAVAPKG_LEN] == '/' || package_name[JAVAPKG_LEN] == '\0'))) { |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
329 |
const char* class_loader_name = SystemDictionary::loader_name(h_loader()); |
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
330 |
size_t pkg_len = strlen(package_name); |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
331 |
char* pkg_name = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, pkg_len); |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
332 |
strncpy(pkg_name, package_name, pkg_len); |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
333 |
StringUtils::replace_no_expand(pkg_name, "/", "."); |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
334 |
const char* msg_text1 = "Class loader (instance of): "; |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
335 |
const char* msg_text2 = " tried to define prohibited package name: "; |
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
336 |
size_t len = strlen(msg_text1) + strlen(class_loader_name) + strlen(msg_text2) + pkg_len + 1; |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
337 |
char* message = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, len); |
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
338 |
jio_snprintf(message, len, "%s%s%s%s", msg_text1, class_loader_name, msg_text2, pkg_name); |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
339 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), message); |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
340 |
} |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
341 |
|
36508 | 342 |
Symbol* pkg_symbol = SymbolTable::new_symbol(package_name, CHECK); |
46322
25836096c89d
8172514: Stop checking for duplicate packages in the JVM_DefineModule() package list
hseigel
parents:
46296
diff
changeset
|
343 |
pkg_list->append(pkg_symbol); |
36508 | 344 |
} |
345 |
||
346 |
ModuleEntryTable* module_table = get_module_entry_table(h_loader, CHECK); |
|
347 |
assert(module_table != NULL, "module entry table shouldn't be null"); |
|
348 |
||
349 |
// Create symbol* entry for module name. |
|
350 |
TempNewSymbol module_symbol = SymbolTable::new_symbol(module_name, CHECK); |
|
351 |
||
352 |
bool dupl_modules = false; |
|
353 |
||
354 |
// Create symbol* entry for module version. |
|
355 |
TempNewSymbol version_symbol; |
|
356 |
if (module_version != NULL) { |
|
357 |
version_symbol = SymbolTable::new_symbol(module_version, CHECK); |
|
358 |
} else { |
|
359 |
version_symbol = NULL; |
|
360 |
} |
|
361 |
||
362 |
// Create symbol* entry for module location. |
|
363 |
const char* module_location = NULL; |
|
364 |
TempNewSymbol location_symbol = NULL; |
|
365 |
if (location != NULL) { |
|
366 |
module_location = |
|
367 |
java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(location)); |
|
368 |
if (module_location != NULL) { |
|
369 |
location_symbol = SymbolTable::new_symbol(module_location, CHECK); |
|
370 |
} |
|
371 |
} |
|
372 |
||
373 |
ClassLoaderData* loader_data = ClassLoaderData::class_loader_data_or_null(h_loader()); |
|
374 |
assert(loader_data != NULL, "class loader data shouldn't be null"); |
|
375 |
||
376 |
PackageEntryTable* package_table = NULL; |
|
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
377 |
PackageEntry* existing_pkg = NULL; |
36508 | 378 |
{ |
379 |
MutexLocker ml(Module_lock, THREAD); |
|
380 |
||
381 |
if (num_packages > 0) { |
|
382 |
package_table = get_package_entry_table(h_loader, CHECK); |
|
383 |
assert(package_table != NULL, "Missing package_table"); |
|
384 |
||
385 |
// Check that none of the packages exist in the class loader's package table. |
|
386 |
for (int x = 0; x < pkg_list->length(); x++) { |
|
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
387 |
existing_pkg = package_table->lookup_only(pkg_list->at(x)); |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
388 |
if (existing_pkg != NULL) { |
36508 | 389 |
// This could be because the module was already defined. If so, |
390 |
// report that error instead of the package error. |
|
391 |
if (module_table->lookup_only(module_symbol) != NULL) { |
|
392 |
dupl_modules = true; |
|
393 |
} |
|
394 |
break; |
|
395 |
} |
|
396 |
} |
|
397 |
} // if (num_packages > 0)... |
|
398 |
||
399 |
// Add the module and its packages. |
|
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
400 |
if (!dupl_modules && existing_pkg == NULL) { |
36508 | 401 |
// Create the entry for this module in the class loader's module entry table. |
46404
ae62ba99a1a7
8165896: Use "open" flag from JVM_DefineModule to export all module packages
rprotacio
parents:
46388
diff
changeset
|
402 |
ModuleEntry* module_entry = module_table->locked_create_entry_or_null(module_handle, |
ae62ba99a1a7
8165896: Use "open" flag from JVM_DefineModule to export all module packages
rprotacio
parents:
46388
diff
changeset
|
403 |
(is_open == JNI_TRUE), module_symbol, |
36508 | 404 |
version_symbol, location_symbol, loader_data); |
405 |
||
406 |
if (module_entry == NULL) { |
|
407 |
dupl_modules = true; |
|
408 |
} else { |
|
409 |
// Add the packages. |
|
410 |
assert(pkg_list->length() == 0 || package_table != NULL, "Bad package table"); |
|
411 |
PackageEntry* pkg; |
|
412 |
for (int y = 0; y < pkg_list->length(); y++) { |
|
413 |
pkg = package_table->locked_create_entry_or_null(pkg_list->at(y), module_entry); |
|
414 |
assert(pkg != NULL, "Unable to create a module's package entry"); |
|
415 |
||
416 |
// Unable to have a GrowableArray of TempNewSymbol. Must decrement the refcount of |
|
417 |
// the Symbol* that was created above for each package. The refcount was incremented |
|
418 |
// by SymbolTable::new_symbol and as well by the PackageEntry creation. |
|
419 |
pkg_list->at(y)->decrement_refcount(); |
|
420 |
} |
|
421 |
||
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
422 |
// Store pointer to ModuleEntry record in java.lang.Module object. |
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
423 |
java_lang_Module::set_module_entry(module_handle(), module_entry); |
36508 | 424 |
} |
425 |
} |
|
426 |
} // Release the lock |
|
427 |
||
428 |
// any errors ? |
|
429 |
if (dupl_modules) { |
|
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
430 |
THROW_MSG(vmSymbols::java_lang_IllegalStateException(), |
36508 | 431 |
err_msg("Module %s is already defined", module_name)); |
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
432 |
} else if (existing_pkg != NULL) { |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
433 |
throw_dup_pkg_exception(module_name, existing_pkg, CHECK); |
36508 | 434 |
} |
435 |
||
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
436 |
log_info(module, load)("%s location: %s", module_name, |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
437 |
module_location != NULL ? module_location : "NULL"); |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
438 |
if (log_is_enabled(Debug, module)) { |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
439 |
outputStream* logst = Log(module)::debug_stream(); |
36508 | 440 |
logst->print("define_module(): creation of module: %s, version: %s, location: %s, ", |
441 |
module_name, module_version != NULL ? module_version : "NULL", |
|
442 |
module_location != NULL ? module_location : "NULL"); |
|
443 |
loader_data->print_value_on(logst); |
|
444 |
logst->print_cr(", package #: %d", pkg_list->length()); |
|
445 |
for (int y = 0; y < pkg_list->length(); y++) { |
|
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
446 |
log_trace(module)("define_module(): creation of package %s for module %s", |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
447 |
(pkg_list->at(y))->as_C_string(), module_name); |
36508 | 448 |
} |
449 |
} |
|
450 |
||
37773
e5b3e9732c3c
8154956: Module system implementation refresh (4/2016)
alanb
parents:
37248
diff
changeset
|
451 |
// If the module is defined to the boot loader and an exploded build is being |
46463
4bd2ca84df7a
8178604: JVM does not allow defining boot loader modules in exploded build after module system initialization
hseigel
parents:
46458
diff
changeset
|
452 |
// used, prepend <java.home>/modules/modules_name to the system boot class path. |
4bd2ca84df7a
8178604: JVM does not allow defining boot loader modules in exploded build after module system initialization
hseigel
parents:
46458
diff
changeset
|
453 |
if (loader == NULL && !ClassLoader::has_jrt_entry()) { |
40013 | 454 |
ClassLoader::add_to_exploded_build_list(module_symbol, CHECK); |
36508 | 455 |
} |
456 |
} |
|
457 |
||
458 |
void Modules::set_bootloader_unnamed_module(jobject module, TRAPS) { |
|
459 |
ResourceMark rm(THREAD); |
|
460 |
||
461 |
if (module == NULL) { |
|
462 |
THROW_MSG(vmSymbols::java_lang_NullPointerException(), "Null module object"); |
|
463 |
} |
|
464 |
Handle module_handle(THREAD, JNIHandles::resolve(module)); |
|
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
465 |
if (!java_lang_Module::is_instance(module_handle())) { |
36508 | 466 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
467 |
"module is not an instance of type java.lang.Module"); |
36508 | 468 |
} |
469 |
||
470 |
// Ensure that this is an unnamed module |
|
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
471 |
oop name = java_lang_Module::name(module_handle()); |
36508 | 472 |
if (name != NULL) { |
473 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
474 |
"boot loader's unnamed module's java.lang.Module has a name"); |
36508 | 475 |
} |
476 |
||
477 |
// Validate java_base's loader is the boot loader. |
|
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
478 |
oop loader = java_lang_Module::loader(module_handle()); |
36508 | 479 |
if (loader != NULL) { |
480 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
481 |
"Class loader must be the boot class loader"); |
|
482 |
} |
|
46271
979ebd346ecf
8169881: Remove implicit Handle conversions oop->Handle
coleenp
parents:
42656
diff
changeset
|
483 |
Handle h_loader(THREAD, loader); |
36508 | 484 |
|
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
485 |
log_debug(module)("set_bootloader_unnamed_module(): recording unnamed module for boot loader"); |
36508 | 486 |
|
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
487 |
// Set java.lang.Module for the boot loader's unnamed module |
46387 | 488 |
ClassLoaderData* boot_loader_data = ClassLoaderData::the_null_class_loader_data(); |
489 |
ModuleEntry* unnamed_module = boot_loader_data->unnamed_module(); |
|
36508 | 490 |
assert(unnamed_module != NULL, "boot loader's unnamed ModuleEntry not defined"); |
46387 | 491 |
unnamed_module->set_module(boot_loader_data->add_handle(module_handle)); |
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
492 |
// Store pointer to the ModuleEntry in the unnamed module's java.lang.Module object. |
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
493 |
java_lang_Module::set_module_entry(module_handle(), unnamed_module); |
36508 | 494 |
} |
495 |
||
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
496 |
void Modules::add_module_exports(jobject from_module, const char* package_name, jobject to_module, TRAPS) { |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
497 |
if (package_name == NULL) { |
36508 | 498 |
THROW_MSG(vmSymbols::java_lang_NullPointerException(), |
499 |
"package is null"); |
|
500 |
} |
|
501 |
if (from_module == NULL) { |
|
502 |
THROW_MSG(vmSymbols::java_lang_NullPointerException(), |
|
503 |
"from_module is null"); |
|
504 |
} |
|
505 |
ModuleEntry* from_module_entry = get_module_entry(from_module, CHECK); |
|
506 |
if (from_module_entry == NULL) { |
|
507 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
508 |
"from_module cannot be found"); |
|
509 |
} |
|
510 |
||
46404
ae62ba99a1a7
8165896: Use "open" flag from JVM_DefineModule to export all module packages
rprotacio
parents:
46388
diff
changeset
|
511 |
// All packages in unnamed and open modules are exported by default. |
ae62ba99a1a7
8165896: Use "open" flag from JVM_DefineModule to export all module packages
rprotacio
parents:
46388
diff
changeset
|
512 |
if (!from_module_entry->is_named() || from_module_entry->is_open()) return; |
36508 | 513 |
|
514 |
ModuleEntry* to_module_entry; |
|
515 |
if (to_module == NULL) { |
|
516 |
to_module_entry = NULL; // It's an unqualified export. |
|
517 |
} else { |
|
518 |
to_module_entry = get_module_entry(to_module, CHECK); |
|
519 |
if (to_module_entry == NULL) { |
|
520 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
521 |
"to_module is invalid"); |
|
522 |
} |
|
523 |
} |
|
524 |
||
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
525 |
PackageEntry *package_entry = get_package_entry(from_module_entry, package_name, CHECK); |
36508 | 526 |
ResourceMark rm(THREAD); |
527 |
if (package_entry == NULL) { |
|
528 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
529 |
err_msg("Package %s not found in from_module %s", |
|
530 |
package_name != NULL ? package_name : "", |
|
531 |
from_module_entry->name()->as_C_string())); |
|
532 |
} |
|
533 |
if (package_entry->module() != from_module_entry) { |
|
534 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
535 |
err_msg("Package: %s found in module %s, not in from_module: %s", |
|
536 |
package_entry->name()->as_C_string(), |
|
537 |
package_entry->module()->name()->as_C_string(), |
|
538 |
from_module_entry->name()->as_C_string())); |
|
539 |
} |
|
540 |
||
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
541 |
log_debug(module)("add_module_exports(): package %s in module %s is exported to module %s", |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
542 |
package_entry->name()->as_C_string(), |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
543 |
from_module_entry->name()->as_C_string(), |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
544 |
to_module_entry == NULL ? "NULL" : |
36508 | 545 |
to_module_entry->is_named() ? |
546 |
to_module_entry->name()->as_C_string() : UNNAMED_MODULE); |
|
547 |
||
39290
0cc9f5028562
8156871: Possible concurrency issue with JVM_AddModuleExports
lfoltan
parents:
38733
diff
changeset
|
548 |
// Do nothing if modules are the same. |
0cc9f5028562
8156871: Possible concurrency issue with JVM_AddModuleExports
lfoltan
parents:
38733
diff
changeset
|
549 |
if (from_module_entry != to_module_entry) { |
36508 | 550 |
package_entry->set_exported(to_module_entry); |
551 |
} |
|
552 |
} |
|
553 |
||
554 |
||
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
555 |
void Modules::add_module_exports_qualified(jobject from_module, const char* package, |
36508 | 556 |
jobject to_module, TRAPS) { |
557 |
if (to_module == NULL) { |
|
558 |
THROW_MSG(vmSymbols::java_lang_NullPointerException(), |
|
559 |
"to_module is null"); |
|
560 |
} |
|
561 |
add_module_exports(from_module, package, to_module, CHECK); |
|
562 |
} |
|
563 |
||
564 |
void Modules::add_reads_module(jobject from_module, jobject to_module, TRAPS) { |
|
565 |
if (from_module == NULL) { |
|
566 |
THROW_MSG(vmSymbols::java_lang_NullPointerException(), |
|
567 |
"from_module is null"); |
|
568 |
} |
|
569 |
||
570 |
ModuleEntry* from_module_entry = get_module_entry(from_module, CHECK); |
|
571 |
if (from_module_entry == NULL) { |
|
572 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
573 |
"from_module is not valid"); |
|
574 |
} |
|
575 |
||
576 |
ModuleEntry* to_module_entry; |
|
577 |
if (to_module != NULL) { |
|
578 |
to_module_entry = get_module_entry(to_module, CHECK); |
|
579 |
if (to_module_entry == NULL) { |
|
580 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
581 |
"to_module is invalid"); |
|
582 |
} |
|
583 |
} else { |
|
584 |
to_module_entry = NULL; |
|
585 |
} |
|
586 |
||
587 |
ResourceMark rm(THREAD); |
|
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
588 |
log_debug(module)("add_reads_module(): Adding read from module %s to module %s", |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
589 |
from_module_entry->is_named() ? |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
590 |
from_module_entry->name()->as_C_string() : UNNAMED_MODULE, |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
591 |
to_module_entry == NULL ? "all unnamed" : |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
592 |
(to_module_entry->is_named() ? |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
593 |
to_module_entry->name()->as_C_string() : UNNAMED_MODULE)); |
36508 | 594 |
|
595 |
// if modules are the same or if from_module is unnamed then no need to add the read. |
|
596 |
if (from_module_entry != to_module_entry && from_module_entry->is_named()) { |
|
597 |
from_module_entry->add_read(to_module_entry); |
|
598 |
} |
|
599 |
} |
|
600 |
||
601 |
// This method is called by JFR and JNI. |
|
602 |
jobject Modules::get_module(jclass clazz, TRAPS) { |
|
42636
aafc434ba580
8169734: Update uses of string "java.base" to macro
rprotacio
parents:
41691
diff
changeset
|
603 |
assert(ModuleEntryTable::javabase_defined(), |
aafc434ba580
8169734: Update uses of string "java.base" to macro
rprotacio
parents:
41691
diff
changeset
|
604 |
"Attempt to call get_module before " JAVA_BASE_NAME " is defined"); |
36508 | 605 |
|
606 |
if (clazz == NULL) { |
|
607 |
THROW_MSG_(vmSymbols::java_lang_NullPointerException(), |
|
608 |
"class is null", JNI_FALSE); |
|
609 |
} |
|
610 |
oop mirror = JNIHandles::resolve_non_null(clazz); |
|
611 |
if (mirror == NULL) { |
|
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
612 |
log_debug(module)("get_module(): no mirror, returning NULL"); |
36508 | 613 |
return NULL; |
614 |
} |
|
615 |
if (!java_lang_Class::is_instance(mirror)) { |
|
616 |
THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(), |
|
617 |
"Invalid class", JNI_FALSE); |
|
618 |
} |
|
619 |
||
620 |
oop module = java_lang_Class::module(mirror); |
|
621 |
||
622 |
assert(module != NULL, "java.lang.Class module field not set"); |
|
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
623 |
assert(java_lang_Module::is_instance(module), "module is not an instance of type java.lang.Module"); |
36508 | 624 |
|
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
625 |
if (log_is_enabled(Debug, module)) { |
36508 | 626 |
ResourceMark rm(THREAD); |
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
627 |
outputStream* logst = Log(module)::debug_stream(); |
36508 | 628 |
Klass* klass = java_lang_Class::as_Klass(mirror); |
44520
0553e129e0ec
8177530: Module system implementation refresh (4/2017)
alanb
parents:
44326
diff
changeset
|
629 |
oop module_name = java_lang_Module::name(module); |
36508 | 630 |
if (module_name != NULL) { |
631 |
logst->print("get_module(): module "); |
|
632 |
java_lang_String::print(module_name, tty); |
|
633 |
} else { |
|
634 |
logst->print("get_module(): Unamed Module"); |
|
635 |
} |
|
636 |
if (klass != NULL) { |
|
637 |
logst->print_cr(" for class %s", klass->external_name()); |
|
638 |
} else { |
|
639 |
logst->print_cr(" for primitive class"); |
|
640 |
} |
|
641 |
} |
|
642 |
||
643 |
return JNIHandles::make_local(THREAD, module); |
|
644 |
} |
|
645 |
||
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
646 |
jobject Modules::get_named_module(Handle h_loader, const char* package_name, TRAPS) { |
39706 | 647 |
assert(ModuleEntryTable::javabase_defined(), |
42636
aafc434ba580
8169734: Update uses of string "java.base" to macro
rprotacio
parents:
41691
diff
changeset
|
648 |
"Attempt to call get_named_module before " JAVA_BASE_NAME " is defined"); |
39706 | 649 |
assert(h_loader.is_null() || java_lang_ClassLoader::is_subclass(h_loader->klass()), |
650 |
"Class loader is not a subclass of java.lang.ClassLoader"); |
|
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
651 |
assert(package_name != NULL, "the package_name should not be NULL"); |
39706 | 652 |
|
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
653 |
if (strlen(package_name) == 0) { |
39706 | 654 |
return NULL; |
655 |
} |
|
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
656 |
TempNewSymbol package_sym = SymbolTable::new_symbol(package_name, CHECK_NULL); |
39706 | 657 |
const PackageEntry* const pkg_entry = |
658 |
get_package_entry_by_name(package_sym, h_loader, THREAD); |
|
659 |
const ModuleEntry* const module_entry = (pkg_entry != NULL ? pkg_entry->module() : NULL); |
|
660 |
||
661 |
if (module_entry != NULL && module_entry->module() != NULL && module_entry->is_named()) { |
|
662 |
return JNIHandles::make_local(THREAD, JNIHandles::resolve(module_entry->module())); |
|
663 |
} |
|
664 |
return NULL; |
|
665 |
} |
|
666 |
||
667 |
||
36508 | 668 |
// This method is called by JFR and by the above method. |
669 |
jobject Modules::get_module(Symbol* package_name, Handle h_loader, TRAPS) { |
|
670 |
const PackageEntry* const pkg_entry = |
|
671 |
get_package_entry_by_name(package_name, h_loader, THREAD); |
|
672 |
const ModuleEntry* const module_entry = (pkg_entry != NULL ? pkg_entry->module() : NULL); |
|
673 |
||
674 |
if (module_entry != NULL && |
|
675 |
module_entry->module() != NULL) { |
|
676 |
return JNIHandles::make_local(THREAD, JNIHandles::resolve(module_entry->module())); |
|
677 |
} |
|
678 |
||
679 |
return NULL; |
|
680 |
} |
|
681 |
||
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
682 |
void Modules::add_module_package(jobject module, const char* package_name, TRAPS) { |
36508 | 683 |
ResourceMark rm(THREAD); |
684 |
||
685 |
if (module == NULL) { |
|
686 |
THROW_MSG(vmSymbols::java_lang_NullPointerException(), |
|
687 |
"module is null"); |
|
688 |
} |
|
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
689 |
if (package_name == NULL) { |
36508 | 690 |
THROW_MSG(vmSymbols::java_lang_NullPointerException(), |
691 |
"package is null"); |
|
692 |
} |
|
693 |
ModuleEntry* module_entry = get_module_entry(module, CHECK); |
|
694 |
if (module_entry == NULL) { |
|
695 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
696 |
"module is invalid"); |
|
697 |
} |
|
698 |
if (!module_entry->is_named()) { |
|
699 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
700 |
"module cannot be an unnamed module"); |
|
701 |
} |
|
702 |
if (!verify_package_name(package_name)) { |
|
703 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
704 |
err_msg("Invalid package name: %s", package_name)); |
|
705 |
} |
|
706 |
||
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
707 |
ClassLoaderData *loader_data = module_entry->loader_data(); |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
708 |
|
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
709 |
// Only modules defined to either the boot or platform class loader, can define a "java/" package. |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
710 |
if (!loader_data->is_the_null_class_loader_data() && |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
711 |
!loader_data->is_platform_class_loader_data() && |
44326
6c59cca7ff07
8174823: Module system implementation refresh (3/2017)
alanb
parents:
43471
diff
changeset
|
712 |
(strncmp(package_name, JAVAPKG, JAVAPKG_LEN) == 0 && |
6c59cca7ff07
8174823: Module system implementation refresh (3/2017)
alanb
parents:
43471
diff
changeset
|
713 |
(package_name[JAVAPKG_LEN] == '/' || package_name[JAVAPKG_LEN] == '\0'))) { |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
714 |
const char* class_loader_name = SystemDictionary::loader_name(loader_data); |
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
715 |
size_t pkg_len = strlen(package_name); |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
716 |
char* pkg_name = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, pkg_len); |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
717 |
strncpy(pkg_name, package_name, pkg_len); |
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
718 |
StringUtils::replace_no_expand(pkg_name, "/", "."); |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
719 |
const char* msg_text1 = "Class loader (instance of): "; |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
720 |
const char* msg_text2 = " tried to define prohibited package name: "; |
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
721 |
size_t len = strlen(msg_text1) + strlen(class_loader_name) + strlen(msg_text2) + pkg_len + 1; |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
722 |
char* message = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, len); |
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
723 |
jio_snprintf(message, len, "%s%s%s%s", msg_text1, class_loader_name, msg_text2, pkg_name); |
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
724 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), message); |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
725 |
} |
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
726 |
|
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
727 |
log_debug(module)("add_module_package(): Adding package %s to module %s", |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
728 |
package_name, module_entry->name()->as_C_string()); |
36508 | 729 |
|
730 |
TempNewSymbol pkg_symbol = SymbolTable::new_symbol(package_name, CHECK); |
|
42307
cefc81dc1d52
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41691
diff
changeset
|
731 |
PackageEntryTable* package_table = loader_data->packages(); |
36508 | 732 |
assert(package_table != NULL, "Missing package_table"); |
733 |
||
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
734 |
PackageEntry* existing_pkg = NULL; |
36508 | 735 |
{ |
736 |
MutexLocker ml(Module_lock, THREAD); |
|
737 |
||
738 |
// Check that the package does not exist in the class loader's package table. |
|
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
739 |
existing_pkg = package_table->lookup_only(pkg_symbol); |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
740 |
if (existing_pkg == NULL) { |
36508 | 741 |
PackageEntry* pkg = package_table->locked_create_entry_or_null(pkg_symbol, module_entry); |
742 |
assert(pkg != NULL, "Unable to create a module's package entry"); |
|
743 |
} |
|
744 |
} |
|
43446
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
745 |
if (existing_pkg != NULL) { |
4f9ac7ab99d9
8172288: Fix Jigsaw related module/package error messages and throw correct exceptions
hseigel
parents:
42656
diff
changeset
|
746 |
throw_dup_pkg_exception(module_entry->name()->as_C_string(), existing_pkg, CHECK); |
36508 | 747 |
} |
748 |
} |
|
749 |
||
750 |
// Export package in module to all unnamed modules. |
|
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
751 |
void Modules::add_module_exports_to_all_unnamed(jobject module, const char* package_name, TRAPS) { |
36508 | 752 |
if (module == NULL) { |
753 |
THROW_MSG(vmSymbols::java_lang_NullPointerException(), |
|
754 |
"module is null"); |
|
755 |
} |
|
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
756 |
if (package_name == NULL) { |
36508 | 757 |
THROW_MSG(vmSymbols::java_lang_NullPointerException(), |
758 |
"package is null"); |
|
759 |
} |
|
760 |
ModuleEntry* module_entry = get_module_entry(module, CHECK); |
|
761 |
if (module_entry == NULL) { |
|
762 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
763 |
"module is invalid"); |
|
764 |
} |
|
765 |
||
766 |
if (module_entry->is_named()) { // No-op for unnamed module. |
|
43466
add500644443
8171855: Move package name transformations during module bootstrap into native code
redestad
parents:
43446
diff
changeset
|
767 |
PackageEntry *package_entry = get_package_entry(module_entry, package_name, CHECK); |
36508 | 768 |
ResourceMark rm(THREAD); |
769 |
if (package_entry == NULL) { |
|
770 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
771 |
err_msg("Package %s not found in module %s", |
|
772 |
package_name != NULL ? package_name : "", |
|
773 |
module_entry->name()->as_C_string())); |
|
774 |
} |
|
775 |
if (package_entry->module() != module_entry) { |
|
776 |
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), |
|
777 |
err_msg("Package: %s found in module %s, not in module: %s", |
|
778 |
package_entry->name()->as_C_string(), |
|
779 |
package_entry->module()->name()->as_C_string(), |
|
780 |
module_entry->name()->as_C_string())); |
|
781 |
} |
|
782 |
||
44993
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
783 |
log_debug(module)("add_module_exports_to_all_unnamed(): package %s in module" |
f61bcd80ec1f
8178380: Module system implementation refresh (5/2017)
alanb
parents:
44520
diff
changeset
|
784 |
" %s is exported to all unnamed modules", |
36508 | 785 |
package_entry->name()->as_C_string(), |
786 |
module_entry->name()->as_C_string()); |
|
787 |
||
43471
bfb383279a16
8171971: Fix timing bug in JVM management of package export lists
hseigel
parents:
43466
diff
changeset
|
788 |
// Mark package as exported to all unnamed modules. |
bfb383279a16
8171971: Fix timing bug in JVM management of package export lists
hseigel
parents:
43466
diff
changeset
|
789 |
package_entry->set_is_exported_allUnnamed(); |
36508 | 790 |
} |
791 |
} |