-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b48
-
generic
-
generic
-
Verified
The compiler generates both a warning and an error on this program:
class Outer<T extends Number & Comparable<String>> {
void foo(T t) {
Comparable<Integer> ci = (Comparable<Integer>) t;
}
}
Outer.java:3: warning: [unchecked] unchecked cast
found : T
required: java.lang.Comparable<java.lang.Integer>
Comparable<Integer> ci = (Comparable<Integer>) t;
^
Outer.java:3: inconvertible types
found : T
required: java.lang.Comparable<java.lang.Integer>
Comparable<Integer> ci = (Comparable<Integer>) t;
^
1 error
1 warning
class Outer<T extends Number & Comparable<String>> {
void foo(T t) {
Comparable<Integer> ci = (Comparable<Integer>) t;
}
}
Outer.java:3: warning: [unchecked] unchecked cast
found : T
required: java.lang.Comparable<java.lang.Integer>
Comparable<Integer> ci = (Comparable<Integer>) t;
^
Outer.java:3: inconvertible types
found : T
required: java.lang.Comparable<java.lang.Integer>
Comparable<Integer> ci = (Comparable<Integer>) t;
^
1 error
1 warning
- relates to
-
JDK-6541884 javac bug (JDK6): missing unchecked warning
- Closed
-
JDK-6790039 overhaul cast-conversion (umbrella)
- Closed
-
JDK-6526446 Fixes to JLS5.5 Casting Conversion
- Closed
-
JDK-6557279 Tweak provable distinctness
- Closed