RFR: 8288120: VerifyError with JEP 405 pattern match [v2]

Vicente Romero vromero at openjdk.org
Tue Jun 21 14:54:49 UTC 2022


On Mon, 20 Jun 2022 12:00:49 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> When pattern matching is looking up the accessor methods, it currently uses `Scope.findFirst`. This method may find a method with the same name from the record's supertype. The proposal is to use `Resolve.resolveInternalMethod` which should lookup the methods based on the ordinary rules, and should find the accessor from the record.
>
> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Using component's accessor, as suggested.

Marked as reviewed by vromero (Reviewer).

lgtm

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java line 359:

> 357:                                                   currentClass);
> 358:             JCStatement accessorStatement =
> 359:                     make.Return(make.App(make.Select(make.Ident(proxy.params().head), c.accessor)));

I let this to your consideration: it could be worth as part of this patch to check if there are other places in the record patterns code that can benefit from this simplification.

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

PR: https://git.openjdk.org/jdk19/pull/34Marked as reviewed by vromero (Reviewer).


More information about the compiler-dev mailing list