RFR: 8262891: Compiler implementation for Pattern Matching for switch (Preview) [v5]
Jan Lahoda
jlahoda at openjdk.java.net
Fri May 28 11:36:10 UTC 2021
On Thu, 27 May 2021 10:38:08 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Jan Lahoda has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 12 commits:
>>
>> - Post-merge fix - need to include jdk.internal.javac in the list of packages used by jdk.compiler again, as we now (again) have a preview feature in javac.
>> - Correcting LineNumberTable for rule switches.
>> - Merging master into JDK-8262891
>> - Fixing various error-related bugs.
>> - Avoiding fall-through from the total case to a synthetic default but changing total patterns to default.
>> - Reflecting recent spec changes.
>> - Reflecting review comments.
>> - Reflecting review comments on SwitchBootstraps.
>> - Trailing whitespaces.
>> - Cleanup, reflecting review comments.
>> - ... and 2 more: https://git.openjdk.java.net/jdk/compare/083416d3...fd748501
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1657:
>
>> 1655:
>> 1656: try {
>> 1657: boolean enumSwitch = (seltype.tsym.flags() & Flags.ENUM) != 0;
>
> This is getting convoluted enough that an enum on the AST (e.g. SwitchKind) might be helpful to save some of these classification properties - which I imagine we have to redo at some point later (e.g. in Lower/TransPattern). I'm ok with fixing in a followup issue.
Thanks Maurizio. Yes, some of the logic is partly repeated elsewhere, but I need to investigate how to improve that. I've filled:
https://bugs.openjdk.java.net/browse/JDK-8267929
-------------
PR: https://git.openjdk.java.net/jdk/pull/3863
More information about the compiler-dev
mailing list