The "bind" operation is traditionally used for taking an instance
method (that takes an object instance as its 0th argument), and
binding it to a specific instance. It's an admittedly minor semantic
point. I don't think technically there'd be a difficulty in having it
work on primitives, it's just that it ain't the intent; you still use
insertArguments() for uses that are not semantically "bind"s.

Attila.

On Tue, Jul 24, 2012 at 6:36 AM, Aleksey Shipilev
<aleksey.shipi...@oracle.com> wrote:
> 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.
>
>
> _______________________________________________
> mlvm-dev mailing list
> mlvm-dev@openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
>
_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to