Skip to content
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

8266027: The diamond finder does not find diamond candidates in field initializers #3713

Closed
wants to merge 1 commit into from

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Apr 27, 2021

Consider code like:

public class Test {
     private List<String> f2 = new LinkedList<String>();
}

Running with javac with -XDfind=diamond will not produce any warning about a possible diamond use. The reason is that the field:

private List<String> f2 = new LinkedList<String>();

will get wrapped by a block, and attributed as a block, but since it has the private modifier, an error will be produced, and the transformation will be deemed impossible.

The proposed solution is to clear the modifiers when/if wrapping fields with blocks.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8266027: The diamond finder does not find diamond candidates in field initializers

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/3713/head:pull/3713
$ git checkout pull/3713

Update a local copy of the PR:
$ git checkout pull/3713
$ git pull https://git.openjdk.java.net/jdk pull/3713/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 3713

View PR using the GUI difftool:
$ git pr show -t 3713

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/3713.diff

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Apr 27, 2021

👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr label Apr 27, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Apr 27, 2021

@lahodaj The following label will be automatically applied to this pull request:

  • compiler

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.

@openjdk openjdk bot added the compiler label Apr 27, 2021
@mlbridge
Copy link

@mlbridge mlbridge bot commented Apr 27, 2021

Webrevs

jbf
jbf approved these changes Apr 27, 2021
Copy link
Member

@jbf jbf left a comment

Looks good to me

@openjdk
Copy link

@openjdk openjdk bot commented Apr 27, 2021

@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:

8266027: The diamond finder does not find diamond candidates in field initializers

Reviewed-by: jfranck, vromero

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 43 new commits pushed to the master branch:

  • 7f4a9f6: 8266088: compiler/arguments/TestPrintOptoAssemblyLineNumbers test should user driver mode
  • f560b89: 8264873: Dependencies: Split ClassHierarchyWalker
  • 0a88f0a: 8255915: jdk/incubator/vector/AddTest.java timed out
  • ab2aec2: 8265938: C2's conditional move optimization does not handle top Phi
  • 5634f20: 8265932: Move safepoint related fields from class Thread to JavaThread
  • b67b2b1: 8265690: Use the latest Ubuntu base image version in Docker testing
  • b2628d1: 8263972: C2: LoadVector/StoreVector type mismatch in MemNode::can_see_stored_value()
  • 377b346: 8264752: SIGFPE crash with option FlightRecorderOptions:threadbuffersize=30M
  • dc323a9: 8263421: Module image file is opened twice during VM startup
  • fbfd4ea: 8265914: Duplicated NotANode and not_a_node
  • ... and 33 more: https://git.openjdk.java.net/jdk/compare/1580a473d09176c1d088285c0f270df146b14fe1...master

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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Apr 27, 2021
//became local variable. If it has some modifiers (except for final), an error
//would be reported, causing the whole rewrite to fail. Removing the non-final
//modifiers from the variable here:
((JCVariableDecl) result).mods.flags &= Flags.FINAL;
Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle Apr 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious: why preserving the FINAL flag anyway?

Copy link
Contributor Author

@lahodaj lahodaj Apr 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular strong reason, just keeping what we can keep. We can clear the flags to 0, if you prefer. I don't think that should cause issues (with the current set of Analyzers).

Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle Apr 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with either approach was just curious, do as you consider best

Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

looks good

@lahodaj
Copy link
Contributor Author

@lahodaj lahodaj commented Apr 29, 2021

/integrate

@openjdk openjdk bot closed this Apr 29, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Apr 29, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Apr 29, 2021

@lahodaj Since your change was applied there have been 106 commits pushed to the master branch:

  • 8072ea5: 8238173: jshell - switch statement with a single default not return cause syntax error
  • c76ce28: 8265842: G1: Introduce API to run multiple separate tasks in a single gangtask
  • 294347b: 8265918: java/io/Console/CharsetTest.java failed with "expect: spawn id exp6 not open"
  • 84b52db: 8265666: Enable AIX build platform to make external debug symbols
  • dd8286e: 8198616: java/awt/Focus/6378278/InputVerifierTest.java fails on mac
  • 5574922: 8266284: ProblemList java/awt/Graphics2D/DrawString/DrawRotatedStringUsingRotatedFont.java
  • df7f0b4: 8198317: Enhance JavacTool.getTask for flexibility
  • 115a413: 8265123: Add static factory methods to com.sun.net.httpserver.Filter
  • 39abac9: 8266176: -Wmaybe-uninitialized happens in libArrayIndexOutOfBoundsExceptionTest.c
  • 155da25: 8265005: Introduce the new client property for mac: apple.awt.windowTitleVisible
  • ... and 96 more: https://git.openjdk.java.net/jdk/compare/1580a473d09176c1d088285c0f270df146b14fe1...master

Your commit was automatically rebased without conflicts.

Pushed as commit f0f6b0d.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler integrated
3 participants