-
Bug
-
Resolution: Future Project
-
P4
-
None
-
5.0
-
generic
-
generic
Javac incorrectly accepts this program in violation
of the spec:
class Test<S> {
void foo() {
A a = new A();
Comparable<Object> c = (Comparable<Object>)a; // Fails as expected
Comparable<S> c2 = (Comparable<S>)a; // Should fail?
}
}
final class A implements Comparable<A> {
public int compareTo(A o) {
return 0;
}
}
###@###.### 2005-05-13 15:37:27 GMT
This appears to be a specification bug so I have changed
the synopsis and reassigned the bug.
of the spec:
class Test<S> {
void foo() {
A a = new A();
Comparable<Object> c = (Comparable<Object>)a; // Fails as expected
Comparable<S> c2 = (Comparable<S>)a; // Should fail?
}
}
final class A implements Comparable<A> {
public int compareTo(A o) {
return 0;
}
}
###@###.### 2005-05-13 15:37:27 GMT
This appears to be a specification bug so I have changed
the synopsis and reassigned the bug.
- relates to
-
JDK-7005095 Cast: compile reject sensible cast from final class to interface
- Closed
-
JDK-4916620 legal cast is rejected
- Closed