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

8272042: java.util.ImmutableCollections$Map1 and MapN should not be @ValueBased #6480

Closed
wants to merge 2 commits into from

Conversation

RogerRiggs
Copy link
Contributor

@RogerRiggs RogerRiggs commented Nov 19, 2021

The jdk.internal.ValueBased annotation was incorrectly applied to subclasses of java.util.AbstractMap.
ValueBased requires that supertypes have no instance fields; AbstractMap has instance fields keySet and values.

Remove the internal @valuebased annotation for subclasses of AbstractMap including:
AbstractImmutableMap, Map1, and MapN.


Progress

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

Issue

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 6480

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

Using diff file

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

…valuebased

Remove the internal @valuebased annotation for subclasses of AbstractMap.
@RogerRiggs
Copy link
Contributor Author

RogerRiggs commented Nov 19, 2021

/csr unneeded
There is no visible behavior change so a CSR is not needed.

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 19, 2021

👋 Welcome back rriggs! 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 Pull request is ready for review label Nov 19, 2021
@openjdk
Copy link

openjdk bot commented Nov 19, 2021

@RogerRiggs determined that a CSR request is not needed for this pull request.

@openjdk
Copy link

openjdk bot commented Nov 19, 2021

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

  • core-libs

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 core-libs core-libs-dev@openjdk.org label Nov 19, 2021
@mlbridge
Copy link

mlbridge bot commented Nov 19, 2021

Webrevs

Copy link
Member

@mlchung mlchung left a comment

It may be helpful to add a comment why these classes are not value-based classes.

@openjdk
Copy link

openjdk bot commented Nov 19, 2021

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

8272042: java.util.ImmutableCollections$Map1 and MapN should not be @ValueBased

Reviewed-by: mchung, iris, naoto, smarks

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

  • bb11c55: 8277542: G1: Move G1CardSetFreePool and related classes to separate files
  • f62b81c: 8273095: vmTestbase/vm/mlvm/anonloader/stress/oome/heap/Test.java fails with "wrong OOME"
  • 05a9a51: 8277423: ciReplay: hidden class with comment expected error
  • 1049aba: 8277576: ProblemList runtime/ErrorHandling/CreateCoredumpOnCrash.java on macosx-X64
  • 851a362: 8264297: Create implementation for NSAccessibilityProgressIndicator protocol peer
  • 6cf4cd1: 8273341: Update Siphash to version 1.0
  • e3911a8: 8277429: Conflicting jpackage static library name
  • 33e2a51: 8265795: vmTestbase/nsk/jvmti/AttachOnDemand/attach022/TestDescription.java fails when running with JEP 416
  • 22f12ac: 8277522: Make formatting of null consistent in Elements
  • e529865: 8277239: SIGSEGV in vrshift_reg_maskedNode::emit
  • ... and 20 more: https://git.openjdk.java.net/jdk/compare/976c2bb05611cdc7b11b0918aaf50ff693507aae...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 Pull request is ready to be integrated label Nov 19, 2021
naotoj
naotoj approved these changes Nov 19, 2021
@jensli
Copy link

jensli commented Nov 21, 2021

Should this change also update the Javadoc on java.util.Map and remove the statement that the return values of Map#of are value-based?

See the documentation on Map.

The documentation on Map refers to the documentation for value-based classes.

Or maybe the documentation on Map should say that Map#of might return value-based objects? In that case the implementation have the possibility to change in the future.

@RogerRiggs
Copy link
Contributor Author

RogerRiggs commented Nov 22, 2021

Should this change also update the Javadoc on java.util.Map and remove the statement that the return values of Map#of are value-based?

This PR is only correcting the application of the internal use annotation to some implementation classes.
The descriptions of unmodifiable maps identify the conditions the clients of Map.of may and may not assume about the returned instances including those related to identity.

@stuart-marks
Copy link
Member

stuart-marks commented Nov 23, 2021

Yes, we want to leave the "value-based" stipulation in the specification, even if the ValueBased annotation is removed. In the future we might be able to remove the dependency on AbstractMap and thus avoid the mutable fields in the unmodifiable collections. Or maybe AbstractMap should lose them entirely. The keySet and values collections are fairly small objects themselves, so caching them might not be much benefit in the first place.

@RogerRiggs
Copy link
Contributor Author

RogerRiggs commented Nov 23, 2021

/integrate

@openjdk
Copy link

openjdk bot commented Nov 23, 2021

Going to push as commit 5e7e2da.
Since your change was applied there have been 38 commits pushed to the master branch:

  • f4dc03e: 8276696: ParallelObjectIterator freed at the wrong time in VM_HeapDumper
  • 90f96fb: 8277441: CompileQueue::add fails with assert(_last->next() == __null) failed: not last
  • 66eaf65: 8277413: Remove unused local variables in jdk.hotspot.agent
  • 36b887a: 8277560: Remove WorkerDataArray::_is_serial
  • 017df14: 8277556: Call ReferenceProcessorPhaseTimes::set_processing_is_mt once
  • 79350b9: 8276216: Negated character classes performance regression in Pattern
  • e3243ee: 8277087: ZipException: zip END header not found at ZipFile#Source.findEND
  • 12f08ba: 8277507: Add jlink.debug system property while launching jpackage tests to help diagonize recent intermittent failures
  • bb11c55: 8277542: G1: Move G1CardSetFreePool and related classes to separate files
  • f62b81c: 8273095: vmTestbase/vm/mlvm/anonloader/stress/oome/heap/Test.java fails with "wrong OOME"
  • ... and 28 more: https://git.openjdk.java.net/jdk/compare/976c2bb05611cdc7b11b0918aaf50ff693507aae...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot closed this Nov 23, 2021
@openjdk openjdk bot added integrated Pull request has been integrated and removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 23, 2021
@openjdk
Copy link

openjdk bot commented Nov 23, 2021

@RogerRiggs Pushed as commit 5e7e2da.

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

@RogerRiggs RogerRiggs deleted the 8272042-not-valuebased branch Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
6 participants