Invokedynamic and Multiple Dispatch

Larry Chester larry.chester at googlemail.com
Sun Feb 28 15:48:40 PST 2010


Hi all

So I've been playing around with invokedynamic (with build 84),
however I've stumbled on something I find quite strange!

Consider two objects a and b that both reference a String. a is
declared as a String but b is only an Object. When I dynamically
invoke with either a or b as an argument I would expect the MethodType
passed to the bootstrap method to be identical.

String a = "hello";
Object b = a;
InvokeDynamic.<void>foo(a);
InvokeDynamic.<void>foo(b);

However, when called with a, the MethodType is (java.lang.String)void;
but with b, it is (java.lang.Object)void.

I've dug around all over the place but can't find anything that
confirms what the behaviour should be in this case. I was hoping
invokedynamic could be used for multiple dispatch but that doesn't
appear possible.

I'm interested what the intended functionality is in this case. Is
that a bug or intended?

Thanks,
Larry


More information about the mlvm-dev mailing list