RFR: 8282274: Compiler implementation for Pattern Matching for switch (Third Preview) [v3]
Jan Lahoda
jlahoda at openjdk.java.net
Mon Apr 18 17:27:31 UTC 2022
On Fri, 15 Apr 2022 15:36:35 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Cleanup.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 1779:
>
>> 1777: //binding pattern
>> 1778: attribExpr(pat, switchEnv);
>> 1779: var primary = TreeInfo.primaryPatternType(pat);
>
> general comment: the handleSwitch method is getting more and more complex, please consider refactoring it, probably splitting it, for example different subrutines handling different case kinds. Of course this probably should be done as a separate effort.
Thanks for the comment. I agree the method is fairly complex, but it is also a bit difficult to disentangle into separate methods. We've separated some of the checks to `Check.checkSwitchCaseStructure` before. I'll try to think of splitting it more, but I am not sure where that will lead.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8182
More information about the core-libs-dev
mailing list