RFR: 8220607 Draft JEP: Hidden Classes

Kasper Nielsen kasperni at gmail.com
Fri Dec 6 20:09:06 UTC 2019

On Thu, 5 Dec 2019 at 01:13, <(unknown sender)> wrote:
> Draft JEP:
>  ? https://bugs.openjdk.java.net/browse/JDK-8220607

Looks good, one quick question though. Is there any reason for the asymmetry
with Lookup.defineClass()? defineHiddenClass() takes a boolean initialize
parameter while defineClass() does not.

Also, as I see it there is no way to defer initialization of a hidden class,
without instantiating an instance of it? Normally you can get around the fact
that Unsafe.ensureClassInitialized is not public via Class.forName.

Making Unsafe.ensureClassInitialized public in some way would also help when
trying to implement the SharedSecrets "pattern" for modular access outside of
the JDK.

try {
    Class.forName(initalizeClass.getName(), true,
} catch (ClassNotFoundException e) {
    throw new ExceptionInInitializerError(e); // Should never happen

Is a bit of an eyesore.


More information about the valhalla-dev mailing list