Sealed/Nestmates in java.time.*

Stephen Colebourne scolebourne at joda.org
Tue Jun 11 13:16:12 UTC 2019


Not sure if this should go to core-libs now. Anyway, I realised today
that three classes in java.time.* probably form a nest and would be a
reaonable test for any new nest/sealed syntax:

* ZoneId
* ZoneOffet
* ZoneRegion

The context was this issue: https://bugs.openjdk.java.net/browse/JDK-8225566

I see these as a nest because the intention is that they form a closed
set with no additional subclasses. (Given that ZoneRegion is
package-private, the exhaustivenss check of sealed types won't be
useful, but it still seems worth documenting in code the closed set)

Stephen


More information about the amber-dev mailing list