Am 07.02.2012 17:29, schrieb Jim Laskey: >>>> MethodType type = MethodType.methodType(Constructor.class, >>>> Class[].class); >>>> MethodHandle mh = MethodHandles.lookup().findVirtual(Class.class, >>>> "getDeclaredConstructor", type); >>>> MethodType target = MethodType.methodType(Object.class, >>>> Object.class, Object.class); >>>> mh = mh.asType(target); >>>> mh.invokeWithArguments(Class.class,new Class[0]); > > As soon as you mh = mh.asType(target); it is no longer vararg, so it > is treating new Class[0] as the second argument cast to Object. If > you are trying to type as (Object , Object[]). I think you are going > to run into difficulties validating (Class[]) Object[]. You may have > to add a wrapper to get what you want, but you could also try using > asCollector.
or in other words: I should not use invokeWithArguments for this. If I wanted to use the same target type... since that is what my call site gives me... and I wanted to use invokeExact instead, how would I have to change the program? bye blackdrag -- Jochen "blackdrag" Theodorou - Groovy Project Tech Lead blog: http://blackdragsview.blogspot.com/ german groovy discussion newsgroup: de.comp.lang.misc For Groovy programming sources visit http://groovy-lang.org _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev