Locating a class file from a class loader by name

Alan Bateman Alan.Bateman at oracle.com
Sun Nov 15 12:04:30 UTC 2015

On 15/11/2015 09:51, Rafael Winterhalter wrote:
> Hi Alan,
> thank you for your feedback. I agree that the current way of 
> implementing a class file lookup is not a fail-safe solution but it 
> works for almost all real use-cases and has therefore become a 
> standard approach used by a lot of code. I wanted to make sure that 
> you are aware of the dependence on such class file lookup of code 
> generation libraries and their heavy use in enterprise software.
We have of course used static analysis on a huge number of libraries to 
get data on usage of these methods. One thing to say about this is that 
such code should work exactly the same as it did with JDK 8 except where 
it is using the ClassLoader APIs to get at JDK-internal resources 
(including .class files). This is because the only modules when 
initially trying out the Jigsaw builds are the platform modules.

We know this is a compatibility issue, it's the second item in the Risks 
and Assumptions section of JEP 261. That compatibility issue could get 
bigger as more code is migrated to modules but this assumes the 
frameworks and tools that are relying on the ClassLoader.getResourceXXX 
methods don't add support for modules. I would hope in time that the 
frameworks and tools will add support for modules, in which case this 
issue should slowly go away.

As to where to lobby for the ClassLoader APIs to support locating 
resources in modules then jpms-spec-comments is the mailing list to send 

> Of course, we will adapt the new APIs into our software but as these 
> libraries are non-commercial and developed after hours, the adoption 
> process will take some time. Currently, all of cglib, Byte Buddy or 
> Javassist do not function with Jigsaw when running the test cases of 
> their current stable build because of null pointer exceptions 
> triggered by unsuccessful class file lookups and I would not know how 
> to fix this problem.
> I will continue to test Jigsaw pre-releases and hope that the 
> mentioned APIs allow for migrating the libraries such that I can offer 
> a version of Byte Buddy that supports Jigsaw rather sooner than later.
Thank you, it's important to have as many people trying out the builds 
and seeing what works and doesn't work. Modules is a huge change to the 
platform and we have to get it right.


More information about the jigsaw-dev mailing list