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

JDK-8296743: Tighten Class.getModifiers spec for array classes #11229

Closed
wants to merge 4 commits into from

Conversation

jddarcy
Copy link
Member

@jddarcy jddarcy commented Nov 18, 2022

Update the spec of Class.getModifiers to match long-standing behavior for primitive and array classes. Remove unneeded implementation flexibility with regard to setting other bit positions. This work was prompted to better support anticipated future Valhalla changes.

Please also review the CSR: https://bugs.openjdk.org/browse/JDK-8297237


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires a CSR request to be approved

Issues

  • JDK-8296743: Tighten Class.getModifiers spec for array classes
  • JDK-8297237: Tighten Class.getModifiers spec for array classes (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11229/head:pull/11229
$ git checkout pull/11229

Update a local copy of the PR:
$ git checkout pull/11229
$ git pull https://git.openjdk.org/jdk pull/11229/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11229

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11229.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 18, 2022

👋 Welcome back darcy! 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 csr Pull request needs approved CSR before integration rfr Pull request is ready for review labels Nov 18, 2022
@openjdk
Copy link

openjdk bot commented Nov 18, 2022

@jddarcy 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 18, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 18, 2022

Webrevs

Copy link
Member

@mlchung mlchung left a comment

Choose a reason for hiding this comment

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

Same change should also be applied to Class::accessFlags?

src/java.base/share/classes/java/lang/Class.java Outdated Show resolved Hide resolved
* If this {@code Class} object represents a primitive type or
* void, its {@code public}, {@code abstract}, and {@code final}
* modifiers are always {@code true}.
* For class objects representing void, primitive types, and
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* For class objects representing void, primitive types, and
* For {@code Class} objects representing void, primitive types, and

Copy link
Member Author

@jddarcy jddarcy Nov 18, 2022

Choose a reason for hiding this comment

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

Yes; I'll make the corresponding change to accessFlags() and its tests; updated PR and CSR momentarily. Thanks.

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Nov 18, 2022
@openjdk
Copy link

openjdk bot commented Nov 18, 2022

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

8296743: Tighten Class.getModifiers spec for array classes

Reviewed-by: rriggs, mchung, heidinga

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

  • 3a15e84: 8297258: Typo in java -help referencing -disable-@files instead of --disable-@files
  • 43ce047: 8178698: javax/sound/midi/Sequencer/MetaCallback.java failed with timeout
  • 035eaee: 8296324: JVMTI GetStackTrace truncates vthread stack trace for agents loaded into running VM
  • 59a308b: 8296632: Write a test to verify the content change of TextArea sends TextEvent
  • 11fc65f: 8023562: [TEST_BUG] java/awt/Mouse/EnterExitEvents/DragWindowTest.java failed on ubuntu 13 and mac 10.11
  • 2c692aa: 8297088: Update LCMS to 2.14
  • 9b4e0e8: 8297080: Remove com/sun/jdi/NashornPopFrameTest.java from the problem list
  • 3272954: 8297083: Remove vmTestbase/nsk/jvmti/GetAllThreads/allthr001 from problem list
  • c4b6920: 8296910: Add EdDSA/XDH/RSASSA-PSS to KeyPairGeneratorBench.java
  • f34ca80: 8297245: JFR: TestRemoteDump should use RemoteRecordingStream
  • ... and 8 more: https://git.openjdk.org/jdk/compare/373e52c0ab0d4fd3c6b18e67e0c46d1d1f0ac91e...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
Copy link

openjdk bot commented Nov 18, 2022

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

8296743: Tighten Class.getModifiers spec for array classes

Reviewed-by: rriggs

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

  • c4b6920: 8296910: Add EdDSA/XDH/RSASSA-PSS to KeyPairGeneratorBench.java
  • f34ca80: 8297245: JFR: TestRemoteDump should use RemoteRecordingStream
  • 13158cb: 8293041: --disable-@files option doesn't work and cause an error
  • 761a4f4: 8295788: C2 compilation hits "assert((mode == ControlAroundStripMined && use == sfpt) || !use->is_reachable_from_root()) failed: missed a node"
  • 2f2d404: 8297129: Inflater documentation refers to 'deflate' methods
  • dd18d76: 8297173: usageTicks and totalTicks should be volatile to ensure that different threads get the latest ticks
  • 2b6dbc7: 8293856: AArch64: Remove clear_inst_mark from aarch64_enc_java_dynamic_call
  • 2f063b8: 8296846: Minor cleanup of some dead code in Flow.java
  • ab6b7ef: 8296901: Do not create unsigned certificate and CRL
  • 7b3984c: 8296463: Memory leak in JVM_StartThread with the integration of Virtual threads

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 18, 2022
Copy link
Member

@mlchung mlchung left a comment

Choose a reason for hiding this comment

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

Looks good.

* </ul>
* If this {@code Class} object represents a primitive type or
* void, the flags are {@code PUBLIC}, {@code ABSTRACT}, and
* {@code FINAL}.
Copy link
Member

Choose a reason for hiding this comment

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

Nit: extra space after * in L1344-1346.

Copy link
Contributor

@DanHeidinga DanHeidinga left a comment

Choose a reason for hiding this comment

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

looks good. Thanks Joe

@pavelrappo
Copy link
Member

Feeling stupid for asking this, but does it make any sense to keep the order of modifiers "blessed" in text and tests?

public protected private
abstract static final transient
volatile synchronized native strictfp

@liach
Copy link
Member

liach commented Nov 18, 2022

In the new paragraph, the modifiers are sorted by their significance in bitwise representation, from least to most significant. Though interface bit comes between final and abstract. However, in the older previous paragraph, they are sorted by the blessed order in source (suggested by JLS). We can consider whether to unify these orders to both blessed or bitwise.

@jddarcy
Copy link
Member Author

jddarcy commented Nov 18, 2022

Feeling stupid for asking this, but does it make any sense to keep the order of modifiers "blessed" in text and tests?

public protected private abstract static final transient volatile synchronized native strictfp

Will address nit before pushing; thanks.

@jddarcy
Copy link
Member Author

jddarcy commented Nov 18, 2022

/integrate

@openjdk
Copy link

openjdk bot commented Nov 18, 2022

Going to push as commit 6fd1442.
Since your change was applied there have been 18 commits pushed to the master branch:

  • 3a15e84: 8297258: Typo in java -help referencing -disable-@files instead of --disable-@files
  • 43ce047: 8178698: javax/sound/midi/Sequencer/MetaCallback.java failed with timeout
  • 035eaee: 8296324: JVMTI GetStackTrace truncates vthread stack trace for agents loaded into running VM
  • 59a308b: 8296632: Write a test to verify the content change of TextArea sends TextEvent
  • 11fc65f: 8023562: [TEST_BUG] java/awt/Mouse/EnterExitEvents/DragWindowTest.java failed on ubuntu 13 and mac 10.11
  • 2c692aa: 8297088: Update LCMS to 2.14
  • 9b4e0e8: 8297080: Remove com/sun/jdi/NashornPopFrameTest.java from the problem list
  • 3272954: 8297083: Remove vmTestbase/nsk/jvmti/GetAllThreads/allthr001 from problem list
  • c4b6920: 8296910: Add EdDSA/XDH/RSASSA-PSS to KeyPairGeneratorBench.java
  • f34ca80: 8297245: JFR: TestRemoteDump should use RemoteRecordingStream
  • ... and 8 more: https://git.openjdk.org/jdk/compare/373e52c0ab0d4fd3c6b18e67e0c46d1d1f0ac91e...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 18, 2022
@openjdk openjdk bot closed this Nov 18, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 18, 2022
@openjdk
Copy link

openjdk bot commented Nov 18, 2022

@jddarcy Pushed as commit 6fd1442.

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

@jddarcy jddarcy deleted the JDK-8296743 branch June 10, 2023 20:12
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