-
Enhancement
-
Resolution: Not an Issue
-
P5
-
None
-
6
-
x86
-
windows_xp
A DESCRIPTION OF THE REQUEST :
It is possible to cast any interface into any other with nary a warning, even if they are unrelated, unless they are parametrized, in which you get an unchecked cast warning. Some sort of unsafe cast warning should be given in all cases.
JUSTIFICATION :
The justification seems obvious: the cast is no less unsafe because the interfaces are raw.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A warning for both casts.
ACTUAL -
Unchecked warning only for the second cast.
---------- BEGIN SOURCE ----------
Iterator itr = new ArrayList().iterator();
Set setr = (Set)itr;
Iterator<String> it = Arrays.asList("A").iterator();
List<String> set = (List<String>)it;
---------- END SOURCE ----------
It is possible to cast any interface into any other with nary a warning, even if they are unrelated, unless they are parametrized, in which you get an unchecked cast warning. Some sort of unsafe cast warning should be given in all cases.
JUSTIFICATION :
The justification seems obvious: the cast is no less unsafe because the interfaces are raw.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A warning for both casts.
ACTUAL -
Unchecked warning only for the second cast.
---------- BEGIN SOURCE ----------
Iterator itr = new ArrayList().iterator();
Set setr = (Set)itr;
Iterator<String> it = Arrays.asList("A").iterator();
List<String> set = (List<String>)it;
---------- END SOURCE ----------