Bug 78591 - [1.5][compiler] missing unchecked cast warning
Summary: [1.5][compiler] missing unchecked cast warning
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 78810 82288 83215 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-11-15 00:04 EST by Igor Fedorenko CLA
Modified: 2005-02-15 06:02 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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