-
Bug
-
Resolution: Cannot Reproduce
-
P3
-
7
-
unknown
-
generic
Here's an example:
List<? extends Number> ln = ...
Object o = (List<String>)ln; //error: inconvertible types
The JLS require an unchecked warning here - because ? extends Number and String are not provably distinct; on the other hand, javac exploits the type info regarding the wildcard upper bound in order to reject that cast as illegal.
Problem arise when either the target or the source type is
*) a type variable with a recursive bound (fbound) - T extends Comparable<T>
*) a captured type variable whose upper bound is recursive
In such a setting, the enhanced type-disjointness test fails, that is, it is possible for javac to consider that two such types are distinct when they are not - the result is an unwanted complilation error where the user would have expected an unchecked warning.
- relates to
-
JDK-6541884 javac bug (JDK6): missing unchecked warning
-
- Closed
-
-
JDK-6557182 Unchecked warning *and* inconvertible types
-
- Closed
-
-
JDK-6569057 Generics regression on cast
-
- Closed
-
-
JDK-6467183 javac fails to raise unchecked warning on cast of parameterized generic subclass
-
- Closed
-
-
JDK-6526449 javac does not accept semantically valid == test
-
- Closed
-
-
JDK-6557279 Tweak provable distinctness
-
- Closed
-
-
JDK-6665356 Cast not allowed when both qualifying type and inner class are parameterized
-
- Closed
-
-
JDK-6270087 Javac rejects legal cast
-
- Closed
-
-
JDK-6507317 Problem when casting from parametrized type to concrete class
-
- Closed
-
-
JDK-6558558 Missing "unchecked" diagnostic
-
- Closed
-
-
JDK-6558559 Extra "unchecked" diagnostic
-
- Closed
-
-
JDK-6558569 Missing unchecked warning
-
- Closed
-
-
JDK-6559175 Unchecked cast, List<?> vs List<? extends Object>
-
- Closed
-
-
JDK-6559179 Unchecked upcast not identified
-
- Closed
-
-
JDK-7005140 Cast: write new regression test checking all combinations
-
- Open
-
-
JDK-6714835 Safe cast is rejected (with warning) by javac
-
- Closed
-
-
JDK-6932571 Compiling Generics causing Inconvertible types
-
- Closed
-