RFR[9]:Fix java/lang/invoke/MethodHandleImpl's use of Unsafe.defineAnonymousClass()

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Fri May 13 13:41:33 UTC 2016


     MethodHandle vamh = prepareForInvoker(MH_checkCallerClass);
     Object ok = bccInvoker.invokeExact(vamh, new Object[]{hostClass, bcc});
+   assert Boolean.TRUE.equals(ok) : ok;

What I meant is to convert the whole test (inside try-catch block) into 
an assert.


+            UNSAFE.ensureClassInitialized(bcc);

Do people see any reason to force invoker class init? I'd prefer to see 
it goes away.

Also, as a second thought, generateInvokerTemplate() looks clearer than 
invokerTemplateGenerator().

Something like the following:
   http://cr.openjdk.java.net/~vlivanov/8149574/webrev.00/

Additional cleanup: checkCallerClass() should return injected invoker 
class when invoked using a method handle, so no need in 2nd argument.

Best regards,
Vladimir Ivanov

On 5/13/16 11:56 AM, shilpi.rastogi at oracle.com wrote:
> Thanks Paul!
>
> Please review http://cr.openjdk.java.net/~srastogi/8149574/webrev10.0/
>
> Regards,
> Shilpi
>
> On 5/13/2016 2:09 PM, Paul Sandoz wrote:
>> assert Boolean.TRUE.equals(ok) : ok;
>



More information about the core-libs-dev mailing list