Quick question regarding pattern matching
Brian Goetz
brian.goetz at oracle.com
Thu Mar 23 18:40:34 UTC 2017
On 3/23/2017 10:32 AM, Brian Goetz wrote:
> Without getting into the details -- I'd like to wait until a Patterns
> JEP is proposed before doing so -- I'll give some quick overview answers.
>
> 1. Yes, exhaustiveness is important. The obvious tool there is
> sealing, and sealed classes at the language level would really also
> like sealing support at the VM level, which can be considered a
> generalization of finality. (Though, even with sealing at both the
> language and VM level, there is still a possibility of being surprised
> by separate compilation artifacts, since if the switch is in a
> different class than the one in which the supposedly-sealed hierarchy
> is defined, new subtypes can still be added, and if the client is not
> recompiled, you will get a surprise.) Stay tuned.
For the record, see this JEP (currently in draft):
https://bugs.openjdk.java.net/browse/JDK-8046171
More information about the amber-dev
mailing list