There is a little bug in Location.isModuleOrientedLocation:
default boolean isModuleOrientedLocation() {
return getName().matches("\\bMODULE\\b");
}
The code around suggests we are supposed to have locations with CAPITALIZED_UNDERSCORE_NAMES. But the regexp: a) does not match anything beyond simple "MODULE" string, because it regexp is un-anchored; b) "\b" does not match "_" to begin with!
jshell> "MODULE".matches("\\bMODULE\\b")
$1 ==> true
jshell> "MODULE_TEST".matches("\\bMODULE\\b")
$2 ==> false
jshell> "MODULE TEST".matches("\\bMODULE\\b")
$3 ==> false
This is less of the problem for `StandardLocation` that would directly implement `isModuleOrientedLocation`. The fix might have external compatibility impact, so it remains to be seen what should be done here.
If we are expanding the check, we needJDK-8351556 to land first to avoid regressions.
default boolean isModuleOrientedLocation() {
return getName().matches("\\bMODULE\\b");
}
The code around suggests we are supposed to have locations with CAPITALIZED_UNDERSCORE_NAMES. But the regexp: a) does not match anything beyond simple "MODULE" string, because it regexp is un-anchored; b) "\b" does not match "_" to begin with!
jshell> "MODULE".matches("\\bMODULE\\b")
$1 ==> true
jshell> "MODULE_TEST".matches("\\bMODULE\\b")
$2 ==> false
jshell> "MODULE TEST".matches("\\bMODULE\\b")
$3 ==> false
This is less of the problem for `StandardLocation` that would directly implement `isModuleOrientedLocation`. The fix might have external compatibility impact, so it remains to be seen what should be done here.
If we are expanding the check, we need
- relates to
-
JDK-8351556 Optimize Location.locationFor/isModuleOrientedLocation
-
- Resolved
-