-
Bug
-
Resolution: Fixed
-
P3
-
17, 18
-
b20
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8276359 | 17.0.3-oracle | Ekaterina Vergizova | P3 | Resolved | Fixed | b01 |
JDK-8276233 | 17.0.2 | Ekaterina Vergizova | P3 | Resolved | Fixed | b04 |
The compiler is currently rejecting this code:
public class X {
abstract class Base {}
interface Marker {}
sealed class B extends Base {}
final class C extends B implements Marker {}
private <T extends Base & Marker> void test(T obj) {
B b = (B) obj; //error - cannot convert T to B
}
}
this seems like a bug in the current implementation of the sealed classes spec (reported offline by Jan)
public class X {
abstract class Base {}
interface Marker {}
sealed class B extends Base {}
final class C extends B implements Marker {}
private <T extends Base & Marker> void test(T obj) {
B b = (B) obj; //error - cannot convert T to B
}
}
this seems like a bug in the current implementation of the sealed classes spec (reported offline by Jan)
- backported by
-
JDK-8276233 unexpected compiler error: cast, intersection types and sealed
-
- Resolved
-
-
JDK-8276359 unexpected compiler error: cast, intersection types and sealed
-
- Resolved
-
- links to
-
Commit openjdk/jdk17u/583844a4
-
Commit openjdk/jdk/fd10f199
-
Review openjdk/jdk17u/220
-
Review openjdk/jdk/6009
(1 links to)