Revisiting JDK-8161269

Alan Bateman Alan.Bateman at
Fri Sep 16 15:30:35 UTC 2016

On 16/09/2016 07:21, David M. Lloyd wrote:

> Hi Alan,
> In JDK-8161269 you said [1] that the "null" class loader has never 
> been specified to contain all Java SE types, using this as a 
> justification to reject this issue as "Not an Issue", regardless of 
> the compatibility impact (particularly the common case of a class 
> loader with a null parent).
The context here is de-privileging non-core components so that they are 
no longer defined to the boot loader with all permissions. Modules such 
as java.corba,, java.sql and many more have no business or 
need to be defined to the boot loader. It would be nice, if over the 
very long term, that we could get to the point where the only module 
defined to the boot loader is java.base. I don't know if we will ever 
get there.

We of course acknowledge that there is potential compatibility impact 
with this change and this is why it is called out in the Risks and 
Assumption section of JEP 261 [1] as

"Some Java SE types have been de-privileged and are now loaded by the 
platform class loader rather than the bootstrap class loader, as noted 
above. Existing custom class loaders that delegate directly to the 
bootstrap class loader might not work correctly; they should be updated 
to delegate to the platform class loader, which is easily available via 
the new ClassLoader::getPlatformClassLoader method."

So far then there hasn't been a lot of feedback on this. The default 
loader for delegation is the system class loader so someone creating a 
class loader that delegates to the boot loader is probably an advanced case.

As noted in the bug report, the ClassLoader javadoc has been updated for 
Java SE 9 to define the built-in class loaders. The most important part 
of this is specifying that all platform classes are visible via the 
platform class loader. That works for Java SE 8 and older if you replace 
"platform" with "extension". I mention this in case there is concerns 
about using a new API in code that needs to be compiled for JDK 8 and 
run on 8 or 9.

I don't have cycles just now to get into the topic of radically changing 
the class loader hierarchy or how modules on the module path are mapped 
to loaders - that topic is an order of magnitude larger than the above, 
esp. once you get into all the scenarios around migration.



More information about the jigsaw-dev mailing list