On 01/12/2011 10:28 PM, Mark Roos wrote:

Done

Though it would be nice if there was a dropArguments api like
        dropArguments(MethodHandle target, int start, int count)

Since I have only one type in my world the value of selecting by types is lost.

Thanks
mark

No, when you invoke a method handle with invokeExact or by invokedynamic,
the VM first checks at runtime the method type. Otherwise, you will be able
to crash the VM.

So the resulting method handle of dropArguments must have a correct method type,
thus you have to provide the classes of the dropt arguments.
In your case, the classes can be easily derived from the target's method type.

something like target.type().parameterList().subList(0, target.type().parameterCount() - 1).toArray(new Class<?>[0]);

Rémi


mlvm-dev-boun...@openjdk.java.net wrote on 01/06/2011 11:25:09 AM:

>
> In that case, the simplest way to go is to generate your GWT
> predicate as a unary MH, but then wrap it in a dropArguments so it
> can take *all* the arguments but drop all but the last.  Then pass
> the the wrapped predicate to guardWithTest.
>
> Agree.


_______________________________________________
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