JSR 292 support, minor change to specification

John Rose john.r.rose at oracle.com
Thu Apr 22 13:59:51 PDT 2010


On Apr 22, 2010, at 1:32 PM, Rémi Forax wrote:

> for item 1.3, I think that defaulting to Object is rough.
> Knowing that the diamond operator uses the type of the lhs part of an 
> assignation
> I wonder if Invokedynamic.foo if no return type is specified should not 
> use the same algorithm.

That sounds very reasonable and probable to me; I would like it better than defaulting to Object.

I don't understand the new defaulting rule enough to know if there would be problems with that.  The interactions between diamond and primitive return types might have to be different for signature-polymorphic calls.

As far as the type system is concerned MH.invoke{Exact,Generic} and InvokeDynamic.foo return an unconstrained result like the following method, which is unrelated to any other type or type variable:

class Foo {
  static <T> T nothingParticular(int a, String b) { return null; }
}

Float i = nothingParticular(123, "456");
Integer i = nothingParticular(123, "456");
int j = nothingParticular(123, "456");

-- John


More information about the coin-dev mailing list