Few questions about invokeDynamic

Rémi Forax forax at univ-mlv.fr
Sat Nov 6 12:28:18 PDT 2010


Le 06/11/2010 17:36, assembling signals a écrit :
> Remi, thank you a lot for such a quick reply!
>
> I tried to do what you suggested, but it keeps failing.
>
> Note, that I don't use some customized build, but instead, as also mentionen in previous mail, JDK7 b116.
> Could you please try the code by yourself? It's a single class.
>
> Thanks again!
>    

You've spot a bug:
(int) methodHandle.invokeExact(); // error: not a statement
should compile.

The compiler should consider it as a statement, like it does
for invokedynamic.

If you use a dummy variable, it works:

     int foo;
     System.out.println("\n\nATTEMPT 1");
     foo = (int)InvokeDynamic.anything();

     System.out.println("\n\nATTEMPT 2");
     foo = (int)methodHandle.invokeExact(); // warning: unchecked 
generic array creation

     System.out.println("\n\nATTEMPT 3");
      foo = (int) methodHandle.invokeExact(); // error: not a statement

Rémi


More information about the mlvm-dev mailing list