mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8154239: -Xbootclasspath/a breaks exploded build
Correct exploded modules build system class path search for the boot loader Reviewed-by: acorn, ccheung, hseigel, jiangli
This commit is contained in:
parent
2313844e20
commit
64f4953141
11 changed files with 338 additions and 312 deletions
|
@ -133,36 +133,6 @@ static PackageEntry* get_package_entry_by_name(Symbol* package,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// If using exploded build, append <java.home>/modules/module_name, if it exists,
|
||||
// to the system boot class path in order for the boot loader to locate class files.
|
||||
static void add_to_exploded_build_list(char *module_name, TRAPS) {
|
||||
assert(!ClassLoader::has_jimage(), "Exploded build not applicable");
|
||||
// java.base is handled by os::set_boot_path
|
||||
assert(strcmp(module_name, "java.base") != 0, "Unexpected java.base module name");
|
||||
|
||||
char file_sep = os::file_separator()[0];
|
||||
size_t module_len = strlen(module_name);
|
||||
|
||||
const char* home = Arguments::get_java_home();
|
||||
size_t len = strlen(home) + module_len + 32;
|
||||
char* path = NEW_C_HEAP_ARRAY(char, len, mtModule);
|
||||
jio_snprintf(path, len, "%s%cmodules%c%s", home, file_sep, file_sep, module_name);
|
||||
struct stat st;
|
||||
// See if exploded module path exists
|
||||
if ((os::stat(path, &st) != 0)) {
|
||||
FREE_C_HEAP_ARRAY(char, path);
|
||||
path = NULL;
|
||||
}
|
||||
|
||||
if (path != NULL) {
|
||||
HandleMark hm;
|
||||
Handle loader_lock = Handle(THREAD, SystemDictionary::system_loader_lock());
|
||||
ObjectLocker ol(loader_lock, THREAD);
|
||||
log_info(class, load)("opened: %s", path);
|
||||
ClassLoader::add_to_list(path);
|
||||
}
|
||||
}
|
||||
|
||||
bool Modules::is_package_defined(Symbol* package, Handle h_loader, TRAPS) {
|
||||
PackageEntry* res = get_package_entry_by_name(package, h_loader, CHECK_false);
|
||||
return res != NULL;
|
||||
|
@ -470,8 +440,8 @@ void Modules::define_module(jobject module, jstring version,
|
|||
// used, prepend <java.home>/modules/modules_name, if it exists, to the system boot class path.
|
||||
if (loader == NULL &&
|
||||
!Universe::is_module_initialized() &&
|
||||
!ClassLoader::has_jimage()) {
|
||||
add_to_exploded_build_list(module_name, CHECK);
|
||||
!ClassLoader::has_jrt_entry()) {
|
||||
ClassLoader::add_to_exploded_build_list(module_symbol, CHECK);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue