| JDK 19 |
|---|
| 19 b12Fixed |
|
CSR :
|
|
|
Relates :
|
|
|
Relates :
|
|
|
Relates :
|
The impl spec of java.time.ZoneId states that ZoneId has two implementations:
"One implementation models region-based IDs, the other is {@code ZoneOffset} modelling offset-based IDs."
The ZoneId constructor has this check to ensure no other subclass can extend it:
ZoneId() {
if (getClass() != ZoneOffset.class && getClass() != ZoneRegion.class) {
throw new AssertionError("Invalid subclass");
}
}
ZoneId can be made a sealed abstract class that permits ZoneOffset and ZoneRegion to extend. The test in the constructor would no longer be needed.
|