[jdk17] RFR: 8268766: Desugaring of pattern matching enum switch should be improved [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri Jun 18 14:29:31 UTC 2021

On Fri, 18 Jun 2021 09:47:29 GMT, Rémi Forax <forax at openjdk.org> wrote:

>> This is to represent cases like:
>>          E sel = null;
>>          switch (sel) {
>>              case A -> {}
>>              case E e && "B".equals(e.name()) -> {}
>>              case C -> {}
>>              case E e -> {}
>>          }
>> The method needs to know which cases represent constants and which represent patterns (even though the primary type of all the patterns will be the enum type), so we cannot easily put the `Class` first (or elide it), and then a `String...`, unless we represent the patterns in the `String...` array somehow.
> Ok got it,
> At some point, we will have to represent patterns either as String and parse them or as Condy of condy if we want a more structured recursive way.

Of course - I missed it! Thanks for the explanation.


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

More information about the compiler-dev mailing list