Fix hierarchy computation of boot layer classes#28
Conversation
|
@Su5eD How have you tested that this won't be causing any issues down the line with classpath collisions? |
|
The system classloader primarily looks for class resources (e.g. those containing a fully qualified class name, such as Alternatively, we can keep the platform classloader and throw a |
|
I know how it works, my problem is that the call to |
|
This was talked through on discord: The current implementation expects the transforming classloader to throw an exception if it could not load the transformed class bytecode, this is not happening, it is just returning an empty array, causing the crash. Proposal for changes:
This should then enable the intended code path with compatible loading to function again. |
Throw ClassNotFoundException if they're not found, remove fallback classloader
| } else if (this.parentLoaders.containsKey(pname)) { | ||
| var cname = name.replace('.','/')+".class"; | ||
| try (var is = this.parentLoaders.getOrDefault(pname, ClassLoader.getSystemClassLoader()).getResourceAsStream(cname)) { | ||
| try (var is = this.parentLoaders.get(pname).getResourceAsStream(cname)) { |
There was a problem hiding this comment.
This is indeed a good idea, since this would else pipe system classes potentially through transformers.
And the call site takes care of this dynamically.
|
This looks much better now, once I figure out how to properly test this stuff, I will pull it out of draft and start the triaging and testing procedure.... |
|
Testing procedures have been setup. |
The issue
As reported in #27, ModuleClassLoader fails to read bytes of libraries on the java boot module layer used in transformers. This happens because it's trying to find resources on the PlatformClassLoader instead of the AppClassLoader.
See here for a full explanation of the issue by @sciwhiz12.
The solution
Quote from sciwhiz's explanation: