Another issue for the Class loaders section?
Scott Stark
sstark at redhat.com
Wed Sep 14 07:26:03 UTC 2016
I would like to bring up an issue for possible addition to the Class loaders section of the JPMS issues summary. The issue is a regression in behavior for ClassLoaders that specify null as their parent ClassLoader. This is a pattern that is quite common in testing frameworks as well as server container frameworks where there a base ClassLoader that wants to isolate the classes and resources visible for loading to it's own set of classes/resources as well as the Java platform classes/resources.
As pointed out in the bug JDK-8161269(http://bugs.java.com/bugdatabase/view_bug.do?bug_id=8161269), a workaround is to use the newer ClassLoader.getPlatformClassLoader() as the parent when null is passed to the ClassLoader(ClassLoader) constructor. There would also seem to be a need for a new ClassLoader constructor that allowed for the specification of the base Module to be used as the source for the parent ClassLoader to enable further restriction of the subset of platform classes that are visible via the instantiated ClassLoader.
Scott
More information about the jpms-spec-comments
mailing list