On 09/16/2016 10:30 AM, Alan Bateman wrote:
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.xml.ws, 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.

OK. For this issue though, would it not make sense to look at the null parent class loader case in a specific and separate way: in the past, such class loaders had access to all platform classes, so as a compatibility factor it would not be unreasonable to take "null" in this *specific* context to mean "platform class loader" and do this translation inside the constructor? Since the change that is really occurring (in any real, observable sense) is that the "null" parent is suddenly shrinking with respect to what it was going back far into history, then the _compatible_ change would appear to be to provide a new ClassLoader value that indicates "java.base (and optionally a few more modules that can decrease over time)", which in reality maps to the bootstrap class loader. This way compatibility is maintained, and the new (in the observable sense) functionality of having a more limited parent CL is still available.

WDYT?
--
- DML

Reply via email to