< prev index next >
src/hotspot/share/classfile/moduleEntry.cpp
Print this page
*** 54,72 ****
if (location != NULL) {
location->increment_refcount();
}
}
! bool ModuleEntry::is_non_jdk_module() {
! ResourceMark rm;
if (location() != NULL) {
const char* loc = location()->as_C_string();
! if (strncmp(loc, "jrt:/java.", 10) != 0 && strncmp(loc, "jrt:/jdk.", 9) != 0) {
! return true;
! }
}
return false;
}
void ModuleEntry::set_version(Symbol* version) {
if (_version != NULL) {
// _version symbol's refcounts are managed by ModuleEntry,
--- 54,90 ----
if (location != NULL) {
location->increment_refcount();
}
}
! // Return true if the module's version should be displayed in error messages,
! // logging, etc.
! // Return false if the module's version is null, if it is unnamed, or if the
! // module is not an upgradeable module.
! // Detect if the module is not upgradeable by checking:
! // 1. Module location is "jrt:/java." and its loader is boot or platform
! // 2. Module location is "jrt:/jdk.", its loader is one of the builtin loaders
! // and its version is the same as module java.base's version
! // The above check is imprecise but should work in almost all cases.
! bool ModuleEntry::should_show_version() {
! if (version() == NULL || !is_named()) return false;
!
if (location() != NULL) {
+ ResourceMark rm;
const char* loc = location()->as_C_string();
! ClassLoaderData* cld = loader_data();
!
! if ((cld->is_the_null_class_loader_data() || cld->is_platform_class_loader_data()) &&
! (strncmp(loc, "jrt:/java.", 10) == 0)) {
! return false;
}
+ if ((ModuleEntryTable::javabase_moduleEntry()->version()->fast_compare(version()) == 0) &&
+ cld->is_permanent_class_loader_data() && (strncmp(loc, "jrt:/jdk.", 9) == 0)) {
return false;
+ }
+ }
+ return true;
}
void ModuleEntry::set_version(Symbol* version) {
if (_version != NULL) {
// _version symbol's refcounts are managed by ModuleEntry,
< prev index next >