Community
Participate
Working Groups
JDTCore v_501 When compiling the following program: public class Y { public static void main(String [] args) { X<String> xs = new X<String>(); String[] s = xs.bar(new String[0]); } } against binaries for X defined as: public class X <T> { <U> U[] bar(U[] u) { return null; } } an invalid type mismatch is reported: Type mismatch: cannot convert from Object[] to String[]
Looks like problem is located in generation of generic method. Some attributes/signatures is invalid, and thus when read back in, the method is thought to be: <U> Object[] bar(Object[]).
Added regression test: GenericTypeTest#test269
Indeed, signature for generic method got generated as: <U:Ljava/lang/Object;>([Ljava/lang/Object;)[Ljava/lang/Object; instead of: <U:Ljava/lang/Object;>([TU;)[TU;
This arises because of array types, if dumping signature for: <U> U bar(U u) correctly issues: <U:Ljava/lang/Object;>(TU;)TU;
ArrayBinding did not override #genericTypeSignature(). Fixed.