Bug 338011 - COMPILER_PB_UNAVOIDABLE_GENERIC_TYPE_PROBLEMS wrongly suppresses constructor parameter type
Summary: COMPILER_PB_UNAVOIDABLE_GENERIC_TYPE_PROBLEMS wrongly suppresses constructor ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-23 14:01 EST by Markus Keller CLA
Modified: 2011-05-03 07:13 EDT (History)
1 user (show)

See Also:


Attachments
Patch under consideration (15.09 KB, patch)
2011-03-15 05:13 EDT, Srikanth Sankaran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2011-02-23 14:01:08 EST
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);
    }
}
Comment 1 Markus Keller CLA 2011-02-28 13:00:36 EST
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);
    }
}
Comment 2 Srikanth Sankaran CLA 2011-03-15 05:13:37 EDT
Created attachment 191198 [details]
Patch under consideration
Comment 3 Srikanth Sankaran CLA 2011-03-15 07:40:25 EDT
Released in HEAD for 3.7 M7
Comment 4 Ayushman Jain CLA 2011-04-26 07:12:37 EDT
Verified for 3.7M7 using build I20110425-1800
Comment 5 Ayushman Jain CLA 2011-05-03 07:13:12 EDT
Verified for 3.7RC0 using build I201104028-0848