RFR: 8315130: java.lang.IllegalAccessError when processing classlist to create CDS archive [v4]
Timofei Pushkin
tpushkin at openjdk.org
Tue Apr 8 11:49:12 UTC 2025
On Mon, 7 Apr 2025 16:15:47 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> Timofei Pushkin has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Don't use URLClassPath
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24223#discussion_r2033015572
More information about the core-libs-dev
mailing list