-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8029633: Raw inner class constructor ref should not perform diamond inference #9784
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
8029633: Raw inner class constructor ref should not perform diamond inference #9784
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. |
@@ -3686,7 +3686,8 @@ class ConstructorReferenceLookupHelper extends ReferenceLookupHelper { | |||
List<Type> typeargtypes, MethodResolutionPhase maxPhase) { | |||
super(referenceTree, names.init, site, argtypes, typeargtypes, maxPhase); | |||
if (site.isRaw()) { | |||
this.site = new ClassType(site.getEnclosingType(), site.tsym.type.getTypeArguments(), site.tsym, site.getMetadata()); | |||
this.site = new ClassType(site.getEnclosingType(), | |||
!site.tsym.isInner() ? site.tsym.type.getTypeArguments() : List.nil(), site.tsym, site.getMetadata()); | |||
needsInference = true; |
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.
Note: so here it seems like we are still doing diamond inference but check that we are creating a new class type with no arguments so no inference will be done in this case (site is an inner class), but we are still setting needsInference
to true in order to reuse the code in Resolve::findDiamond
that creates a new MethodSymbol
for the constructor with the right result type instead of void
Webrevs
|
@vicente-romero-oracle This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
@vicente-romero-oracle This pull request has been inactive for more than 8 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the |
/open |
@vicente-romero-oracle This pull request is now open |
Just to verify I understand it correctly, having something along the lines: I think this patch is in the right direction, but I am not sure about this case:
Note that here:
it seems it should get the diamond inference here? Should the new condition be (The difference is observable as an unchecked warning.) Thanks. |
@lahodaj I think you are right. Good catch! I have updated the PR, thanks! |
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 to me, thanks!
thanks for the review |
@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 27 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 6707bfb.
Your commit was automatically rebased without conflicts. |
@vicente-romero-oracle Pushed as commit 6707bfb. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This PR is synchronizing the compiler with the spec, in particular with this portion of section
15.13.1 Compile-Time Declaration of a Method Reference
:so javac should treat the code below as a raw constructor invocation:
currently javac is rejecting this code
TIA
PS. Please review the related CSR too
Progress
Issues
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9784/head:pull/9784
$ git checkout pull/9784
Update a local copy of the PR:
$ git checkout pull/9784
$ git pull https://git.openjdk.org/jdk pull/9784/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 9784
View PR using the GUI difftool:
$ git pr show -t 9784
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9784.diff