Bug 78591

Summary: [1.5][compiler] missing unchecked cast warning
Product: [Eclipse Project] JDT Reporter: Igor Fedorenko <igor>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: akiezun, leberre, rlenard
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Igor Fedorenko CLA 2004-11-15 00:04:28 EST
Eclipse 3.1 200411101000 does not warn about the following unchecked cast 

======
package test.cheetah;
import java.util.List;
public class Test<T> {
    List<T> list;
    void add(Object abs) {
        list.add((T) abs); // unchecked cast
    }
}
======
Comment 1 Philipe Mulet CLA 2004-12-16 17:14:18 EST
Added support to detect unsafe cast to type variable.
Added regression test: GenericTypeTest#test438.
Also tuned unsafe cast message to read:

1. WARNING in d:\...\src\X.java (at line 6)
	list.add((T) abs); // unchecked cast
	         ^^^^^^^
Type safety: The cast from Object to T will actually check against the erased
type Object at runtime
Comment 2 Philipe Mulet CLA 2004-12-16 17:16:36 EST
Fix will be released once M4 is declared
Comment 3 Philipe Mulet CLA 2005-01-05 09:27:11 EST
*** Bug 78810 has been marked as a duplicate of this bug. ***
Comment 4 Philipe Mulet CLA 2005-01-05 18:56:42 EST
*** Bug 82288 has been marked as a duplicate of this bug. ***
Comment 5 Olivier Thomann CLA 2005-01-19 16:15:44 EST
*** Bug 83215 has been marked as a duplicate of this bug. ***
Comment 6 Jerome Lanneluc CLA 2005-02-15 06:02:37 EST
Verified in I20050214