RFR: 8315130: java.lang.IllegalAccessError when processing classlist to create CDS archive [v4]

Ioi Lam iklam at openjdk.org
Tue Apr 8 17:40:18 UTC 2025


On Tue, 8 Apr 2025 11:46:27 GMT, Timofei Pushkin <tpushkin at openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/misc/CDS.java line 444:
>> 
>>> 442:         protected Class<?> findClass(String name) throws ClassNotFoundException {
>>> 443:             // Unregistered classes should be found in load(...), registered classes should be
>>> 444:             // handeled by parent loaders
>> 
>> Hmm, I wonder how the reference to java.lang.Object is resolved in this case. When `CustomLoadee` is parsed, the ClassFileParser needs to resolve is super class, which should result into a call to `UnregisteredClassLoader::findClass()`.
>> 
>> 
>>             "java/lang/Object id: 0",
>>             "CustomLoadee id: 1 super: 0 source: .",
>
> `UnregisteredClassLoader::loadClass` will be called, i.e. the default implementation from `ClassLoader::loadClass`, which will first try to delegate to parent. The delegation chain will reach the boot loader which will find `java.lang.Object` and thus `UnregisteredClassLoader::findClass()` won't be called.

I think the findClass() method can be deleted as it's identical to the one in URLClassLoader.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24223#discussion_r2033685869


More information about the hotspot-runtime-dev mailing list