Community
Participate
Working Groups
The following code compiles and executes fine with JDK 1.5.0_01 but does not compile with Eclipse 3.1M4: public class Box<T> { private T t; public <A extends T> Box(A t) { this.t = t; } public String toString() { return "[" + t + "]"; } public static void main(String[] args) { //primitive type - error in eclipse System.out.println(new Box<Integer>(10)); //primitive type - workarround for eclipse. System.out.println(new Box<Integer>(new Integer(10))); //reference type - fine everyware System.out.println(new Box<String>("alabala")); } } The compiler issues the following message: "Bound mismatch: The generic constructor Box(A) of type Box<T> is not applicable for the arguments (int) since the type int is not a valid substitute for the bounded parameter <A extends T>" Seems in this particular case the compiler applies generics on the primitive type (int) before it applies autoboxing to conver it to a valid reference type (Integer).
Added AutoBoxing test078.
Verified in I20050215-2300