8243596: ModuleLayer::parents should return an unmodifiable list
Alan Bateman
Alan.Bateman at oracle.com
Tue May 5 19:05:05 UTC 2020
This is an small oversight and inconsistency that crept in when the
ModuleLayer was updated to support multiple parents. The list of parent
layers returned by the parents() method should be specified (and
implemented) to return an unmodifiable list. It currently returns a
modifiable list. The equivalent Configuration::parents is correctly
specified, as is the Configuration::modules and ModuleLayer::modules
methods.
The change proposed here fixes the javadoc and implementation. The
compatibility impact is minimal as nothing could depend on being able to
dynamically change the list of parents (as it can't be changed dynamically).
I've extended the existing tests to ensure that ::modules,
Configuration::parents, ModuleLayer::modules and ModuleLayer::parents
return unmodifiable collections. In passing, there is also a typo in the
Configuration::modules where the javadoc says "immutable" instead of
"unmodifiable".
http://cr.openjdk.java.net/~alanb/8243596/webrev/
The patch doesn't update the date in the copyright headers, I'll update
those before pushing after the changes (and CSR) are agreed.
-Alan
More information about the jigsaw-dev
mailing list