-
Bug
-
Resolution: Duplicate
-
P4
-
5.0
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2121343 | 5.0u10 | Peter Ahe | P4 | Closed | Duplicate |
Name: rmT116609 Date: 06/17/2004
FULL PRODUCT VERSION :
java version "1.5.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta3-b55)
Java HotSpot(TM) Client VM (build 1.5.0-beta3-b55, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
In the following code:
class A {}
class B extends A {}
public class Foo<T> {
public <U extends B> void foo(Foo<? super A> param) {
Foo<U> foo = (Foo<U>)param;
}
}
casting should fail, since the capture of ? super A is not convertible to U
due to bound of U.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Compiler must report an error instead of unchecked assignment.
REPRODUCIBILITY :
This bug can be reproduced always.
(Incident Review ID: 280367)
======================================================================
FULL PRODUCT VERSION :
java version "1.5.0-beta3"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta3-b55)
Java HotSpot(TM) Client VM (build 1.5.0-beta3-b55, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
In the following code:
class A {}
class B extends A {}
public class Foo<T> {
public <U extends B> void foo(Foo<? super A> param) {
Foo<U> foo = (Foo<U>)param;
}
}
casting should fail, since the capture of ? super A is not convertible to U
due to bound of U.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Compiler must report an error instead of unchecked assignment.
REPRODUCIBILITY :
This bug can be reproduced always.
(Incident Review ID: 280367)
======================================================================
- backported by
-
JDK-2121343 Incompatible types are cast without error
- Closed
- duplicates
-
JDK-4916620 legal cast is rejected
- Closed