On 6/3/20 6:24 PM, John Rose wrote:
On Jun 3, 2020, at 5:16 PM, Paul Sandoz <paul.san...@oracle.com <mailto:paul.san...@oracle.com>> wrote:

 if (UNSAFE.shouldBeInitialized(cls)) {
     UNSAFE.ensureClassInitialized(cls);
 }

Although it seems redundant to perform the check, suggesting it is not needed.

It’s useful (IIRC) in this kind of code:

MethodHandle mh = … something about cls ...;
 if (!UNSAFE.shouldBeInitialized(cls))
    return mh;
// Oops, every eventual call to mh needs to do the check:
return filterArguments(mh, 0, UNSAFE_ensureClassInitialized.bindTo(cls));


It is useful for method handle machinery.   I don't see the need to expose it as a supported API for java applications/framework.

Maybe useful for dynamic languages?

Mandy

Reply via email to