[patterns-instanceof] Spec for next version of Patterns in instanceof JEP

Gavin Bierman gavin.bierman at oracle.com
Mon Oct 5 12:53:10 UTC 2020

Dear all:

A draft of the spec for the Patterns in instanceof feature that we plan to
finalize in JDK 16 is now available:


[NB: The URL will change once we have a JEP number, and will be announced.]

The changes are the same as those in the second preview that was released in
Java SE 16, except for minor editorial changes and the following:

- To lift the restriction that pattern variables are implicitly final. This
  allows pattern variables to be considered as a strict subset of local
  variables. A number of simplifications to the spec result from this change. 

- To make it a compile-time error for an expression of type _S_ to be matched
  against a pattern of type _T_, where _S_ is a subtype of _T_. (This pattern
  match will always succeed and is then pointless. The opposite case, where a
  pattern match will always fail is already a compile-time error.) 
Comments welcome!


More information about the amber-spec-experts mailing list