findVirtual problem

Christian Thalinger Christian.Thalinger at Sun.COM
Tue Aug 18 01:55:55 PDT 2009


Hi!

Looks like there is a problem with findVirtual.  Since I don't know very
much about the MethodHandle Java level, I want to be sure it's not my fault.

Doing:

  MethodHandle mh = MethodHandles.lookup().findVirtual(Object.class,
"toString", MethodType.make(String.class));
  String result = mh.<String>invoke("foo");

results in:

  Exception in thread "main" java.dyn.WrongMethodTypeException:
()Ljava/lang/String; cannot be called as
(Ljava/lang/String;)Ljava/lang/String;

which looks very odd to me.  This also happens with other virtuals that
take e.g. ints.  Is it my fault or is there a bug in MethodType?

-- Christian


More information about the mlvm-dev mailing list