Bug 70243

Summary: [1.5] no warning for unsafe cast
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Adam Kiezun CLA 2004-07-16 12:09:36 EDT
latest 1_5 for 07/16

class A{
    void foo(){
        List<Integer> li= new ArrayList<Integer>();
        List<? extends Number> ls= li;       
        List<Number> x2= (List<Number>)ls;//unsafe
        x2.add(new Float(1.0));
        
        Integer i= li.get(0);//ClassCastException!
    }
}

the line marked //unsafe is indeed unsafe
because the assignment 2 lines below throws a CCE
Comment 1 Philipe Mulet CLA 2004-07-20 09:20:10 EDT
Tuned unsafe cast diagnosis to flag wildcard conversions as well.
Added regression test: GenericTypeTest#test253
Fixed.