-
Notifications
You must be signed in to change notification settings - Fork 55
8288120: VerifyError with JEP 405 pattern match #34
Conversation
👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into |
Webrevs
|
.findFirst(component.name, s -> s.kind == Kind.MTH && | ||
((MethodSymbol) s).params.isEmpty()); | ||
MethodSymbol realAccessor = | ||
rs.resolveInternalMethod(pos, env, component.owner.type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: I think that you can just read the accessor
field in the record component, it should point to the accessor's symbol which is what you want here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I didn't realize that! Fixed now.
@@ -359,7 +356,7 @@ private MethodSymbol getAccessor(RecordComponent component) { | |||
type, | |||
currentClass); | |||
JCStatement accessorStatement = | |||
make.Return(make.App(make.Select(make.Ident(proxy.params().head), realAccessor))); | |||
make.Return(make.App(make.Select(make.Ident(proxy.params().head), c.accessor))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, but I don't recall other places in the current pattern matching code that would be looking up the accessors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok sounds good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@lahodaj This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 17 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit bdf9902.
Your commit was automatically rebased without conflicts. |
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 useResolve.resolveInternalMethod
which should lookup the methods based on the ordinary rules, and should find the accessor from the record.Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk19 pull/34/head:pull/34
$ git checkout pull/34
Update a local copy of the PR:
$ git checkout pull/34
$ git pull https://git.openjdk.org/jdk19 pull/34/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 34
View PR using the GUI difftool:
$ git pr show -t 34
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk19/pull/34.diff