> Currently, an enum switch with patterns is desugared in a very non-standard, 
> and potentially slow, way. It would be better to use the standard 
> `typeSwitch` bootstrap to classify the enum constants. The bootstrap needs to 
> accept enum constants as labels in order to allow this. A complication is 
> that if an enum constant is missing, that is not an incompatible change for 
> the switch, and the switch should simply work as if the case for the missing 
> constant didn't exist. So, the proposed solution is to have a new bootstrap 
> `enumSwitch` that accepts `String`s in place of the enum constants, and will 
> internally convert them to the appropriate enum constants, and then it will 
> find the proper case similarly to `typeSwitch`.
> 
> How does this look?

Jan Lahoda has updated the pull request incrementally with one additional 
commit since the last revision:

  Adding a testcase for an enum that implements an interface.

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk17/pull/81/files
  - new: https://git.openjdk.java.net/jdk17/pull/81/files/d970402e..fe3de7d7

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk17&pr=81&range=08
 - incr: https://webrevs.openjdk.java.net/?repo=jdk17&pr=81&range=07-08

  Stats: 25 lines in 1 file changed: 24 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk17/pull/81.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk17 pull/81/head:pull/81

PR: https://git.openjdk.java.net/jdk17/pull/81

Reply via email to