Community
Participate
Working Groups
In the following code Eclipse 3.2M2 reports an error on t1.test() "The method test(Object, V1) in the type Tester is not applicable for the arguments (A, B)" whereas javac only reports an unchecked call. IMHO the compiler should not report anything. ------------------------------------------------ public class Tester<T> { public <V1, V2 extends V1> void test(V1 p1, V2 p2) {} public static void main(String[] args) { A a = new A() {}; B b = new B() {}; Tester t1 = new Tester(); t1.test(a, b); //this gives an error but should be OK Tester<Object> t2 = new Tester<Object>(); t2.test(a, b); //this compiles OK } } interface A { } interface B extends A { } ------------------------------------------------
Reproduced with 3.2M2.
Problem comes from improper substitution for raw type generic parameterized method. public <V1, V2 extends V1> void test(V1 p1, V2 p2) {} ends up being: void test(Object p1, V1 p2) due to incorrect use of variable strict upper bound. It should instead consider variable erasure in raw form. Added GenericTypeTest#test826-827. Fixed both in 3.1.1 stream (> 3.1.1rc2) and HEAD
Now it reports this warning. The method test(Object, Object) belongs to the raw type Tester. References to generic type Tester<T> should be parameterized Tester.java Verified in M20050923-1430 + JDT/Core 3.1.1RC3 candidate