Community
Participate
Working Groups
HEAD COMPILER_PB_UNAVOIDABLE_GENERIC_TYPE_PROBLEMS wrongly suppresses problems for raw constructor parameter types. Even if a super constructor needs a raw type, a subclass can still parametrize its constructor. Here's an example to play with: package p; import java.util.Map; public class A { public A(Map m) { } } package p; import java.util.*; public class C extends A { public C(Map m) { super(m); m.put("one", 1); } public C(Map<String, String> m, boolean b) { super(m); // shows that parametrizing the parameter type is no problem new A(m); m.put("one", 1); } }
The example had an unrelated compile error and didn't tell what was expected. Here's the fixed version: package p; import java.util.*; public class C extends A { public C(Map m) { // should warn about raw type m super(m); m.put("one", 1); // warns about raw method invocation (good) } public C(Map<String, Integer> m, boolean b) { super(m); // shows that parametrizing the parameter type is no problem new A(m); m.put("one", 1); } }
Created attachment 191198 [details] Patch under consideration
Released in HEAD for 3.7 M7
Verified for 3.7M7 using build I20110425-1800
Verified for 3.7RC0 using build I201104028-0848