Community
Participate
Working Groups
The following code should not compile. class Y<T extends Number> { } public class X { public static void main(String argv[]) { m(new Y<Short>(), new Y<Integer>()); } public static <T extends Number> void m(Y<T> x, Y<T> y) { } } Because Y<T> has two definitions. Replacing the method invocation of m with: m(new Y<Integer>(), new Y<Integer>()); compile fine.
I believe we infer T to be: ? extends Number
Actually we do infer: Y<Number&Comparable<?...>>
Intersection type did not play well in type argument containment check. Added GenericTypeTest#test483. Fixed
Verified in I20050214