MethodHandle.bindTo() only for reference types?

Aleksey Shipilev aleksey.shipilev at oracle.com
Tue Jul 24 06:36:03 PDT 2012


Hi,

I wonder if anyone could point to the explanation why MH.bindTo() is
accepting only reference types? This behavior seems surprising for
newcomers like me, mostly because similar API accepts primitive types.
For one, given:

 public static void foo(int i);

...and the MethodHandle mh referring to it, I can do:
 MethodHandle mh2 = MethodHandles.insertArguments(mh, 0, (int)someInt)

...but this one is prohibited:
 MethodHandle mh2 = mh.bindTo((int)someInt);

Thanks,
-Aleksey.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
Url : http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20120724/f7493c69/signature.asc 


More information about the mlvm-dev mailing list