-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8296171: Compiler incorrectly rejects code with variadic method references #11093
8296171: Compiler incorrectly rejects code with variadic method references #11093
Conversation
👋 Welcome back vromero! A progress list of the required criteria for merging this PR into |
@vicente-romero-oracle The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
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.
Looks good - watch out for whitespaces
@@ -3111,7 +3111,8 @@ Pair<Symbol, ReferenceLookupHelper> resolveMemberReference(Env<AttrContext> env, | |||
boundSearchResolveContext.methodCheck = methodCheck; | |||
Symbol boundSym = lookupMethod(boundEnv, env.tree.pos(), | |||
site.tsym, boundSearchResolveContext, boundLookupHelper); | |||
ReferenceLookupResult boundRes = new ReferenceLookupResult(boundSym, boundSearchResolveContext); | |||
boolean isStaticSelector = TreeInfo.isStaticSelector(referenceTree.expr, names); |
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.
This is a good minimal fix I believe.
Moving forward (e.g. maybe in a separate PR) I wonder if it would be useful to make this code less general. E.g. the method reference lookup code comes from a time where we always did two lookups - but the JL:S has later been rectified, so that now we only do two lookups for unbound method references (e.g. those with static qualifier). I think that the current code is not the best in terms of achieving good JLS parity w/ a good readability, because it's trying to do too much. But of course that's an issue that was there before your fix.
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 for the review. Yes I agree that a follow up issue should be filed to track this [1]
@vicente-romero-oracle 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 39 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 3eb789a.
Your commit was automatically rebased without conflicts. |
@vicente-romero-oracle Pushed as commit 3eb789a. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Please review this PR that is syncing javac with the spec. Javac is rejecting this code:
javac indicates that the method reference is invalid when according to the spec the second
foo
method should be selected by the compiler. The related section of the spec can be found at section15.13.1 Compile-Time Declaration of a Method Reference
:Actually the method search is correct but later on javac is seeing that both methods are applicable and given that they have different staticness, it is making wrong assumptions down the road.
TIA
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11093/head:pull/11093
$ git checkout pull/11093
Update a local copy of the PR:
$ git checkout pull/11093
$ git pull https://git.openjdk.org/jdk pull/11093/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 11093
View PR using the GUI difftool:
$ git pr show -t 11093
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11093.diff