Skip to content

Conversation

@blindpirate
Copy link
Contributor

@blindpirate blindpirate commented Nov 15, 2022

As described in JDK-8296329, previously, the jar validator compare the "version" to validate a multi-release jar. The "version" is a mix of the major and minor version fused into a single int, which might be a negative number with --enable-preview - this result in wrong comparison.

This PR fixes it by only comparing major versions.


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

Issue

  • JDK-8296329: jar validator doesn't account for minor class file version

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11153

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

Using diff file

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

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 15, 2022

👋 Welcome back blindpirate! 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 15, 2022
@openjdk
Copy link

openjdk bot commented Nov 15, 2022

@blindpirate The following labels will be automatically applied to this pull request:

  • compiler
  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added core-libs core-libs-dev@openjdk.org compiler compiler-dev@openjdk.org labels Nov 15, 2022
@blindpirate blindpirate changed the title 8296329: Only compare major versions in jar validator 8296329: jar validator doesn't account for minor class file version Nov 15, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 15, 2022

Webrevs

@AlanBateman
Copy link
Contributor

See also JDK-8296119. I don't know how common it will be for someone to publish a MR JAR containing classes compiled to use preview features. It would be a bit inconvenient for users as they would need to know to run with --enable-preview on some releases. This shouldn't impact the API compatibility checking that the jar tool does so dropping the minor version and just checking the major version might be okay.

Copy link
Member

@JornVernee JornVernee left a comment

Choose a reason for hiding this comment

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

Please assign the JBS ticket to yourself as well.

Comment on lines 102 to 116
Copy link
Member

Choose a reason for hiding this comment

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

My concern with this is that this will need to be updated after each release. Looks like there are also ways to directly alter the minor version of a class file, and I recommend doing that instead. See: https://github.com/openjdk/jdk/blob/master/test/hotspot/jtreg/runtime/ClassFile/PreviewVersion.java#L51

Also, there's one more negative case missing where the base version uses 20 + preview features, and the other version is 19.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @JornVernee . I have updated the test, PTAL!

Please assign the JBS ticket to yourself as well.

Sorry, I don't have permission to update JBS ticket.

@openjdk-notifier
Copy link

@blindpirate Please do not rebase or force-push to an active PR as it invalidates existing review comments. All changes will be squashed into a single commit automatically when integrating. See OpenJDK Developers’ Guide for more information.

Copy link
Member

@JornVernee JornVernee left a comment

Choose a reason for hiding this comment

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

This looks good to me. Thanks for fixing.

I'm running a test job for tier 1-4 as well

@openjdk
Copy link

openjdk bot commented Nov 16, 2022

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

8296329: jar validator doesn't account for minor class file version

Reviewed-by: jvernee

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

  • 09f70da: 8296265: Use modern HTML in the JVMTI spec
  • e661c5a: 8296323: JVMTI can_support_virtual_threads not available for agents loaded into running VM
  • 974cb83: 8297310: Remove unimplemented HeapInspection::iterate_over_heap
  • e174558: 8296742: Illegal X509 Extension should not be created
  • a6c418e: 8297168: Provide a bulk OopHandle release mechanism with the ServiceThread
  • 4a544bb: 8297091: New langtools test jdk/javadoc/doclet/testValueTag/TestValueFormats.java fails on machines with unexpected number format
  • b6dddf4: 8239801: [macos] java/awt/Focus/UnaccessibleChoice/AccessibleChoiceTest.java fails
  • 260e4dc: 8295011: EC point multiplication improvement for secp256r1
  • fb6c992: 8296957: One more cast in SAFE_SIZE_NEW_ARRAY2
  • ccc6e16: 8291067: macOS should use O_CLOEXEC instead of FD_CLOEXEC
  • ... and 163 more: https://git.openjdk.org/jdk/compare/8eb90e2d9c4ab5975f4301dbfdb0a6d9fa036af3...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.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@JornVernee) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 16, 2022
@blindpirate
Copy link
Contributor Author

@JornVernee can you please sponsor this PR?

@JornVernee
Copy link
Member

JornVernee commented Nov 23, 2022

@blindpirate Yes. If you /integrate it, I can then /sponsor.

@blindpirate
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Nov 23, 2022
@openjdk
Copy link

openjdk bot commented Nov 23, 2022

@blindpirate
Your change (at version b293cbf) is now ready to be sponsored by a Committer.

@JornVernee
Copy link
Member

/sponsor

@blindpirate
Copy link
Contributor Author

Thanks @JornVernee !

@openjdk
Copy link

openjdk bot commented Nov 23, 2022

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

  • 09f70da: 8296265: Use modern HTML in the JVMTI spec
  • e661c5a: 8296323: JVMTI can_support_virtual_threads not available for agents loaded into running VM
  • 974cb83: 8297310: Remove unimplemented HeapInspection::iterate_over_heap
  • e174558: 8296742: Illegal X509 Extension should not be created
  • a6c418e: 8297168: Provide a bulk OopHandle release mechanism with the ServiceThread
  • 4a544bb: 8297091: New langtools test jdk/javadoc/doclet/testValueTag/TestValueFormats.java fails on machines with unexpected number format
  • b6dddf4: 8239801: [macos] java/awt/Focus/UnaccessibleChoice/AccessibleChoiceTest.java fails
  • 260e4dc: 8295011: EC point multiplication improvement for secp256r1
  • fb6c992: 8296957: One more cast in SAFE_SIZE_NEW_ARRAY2
  • ccc6e16: 8291067: macOS should use O_CLOEXEC instead of FD_CLOEXEC
  • ... and 163 more: https://git.openjdk.org/jdk/compare/8eb90e2d9c4ab5975f4301dbfdb0a6d9fa036af3...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Nov 23, 2022

@JornVernee @blindpirate Pushed as commit faf48e6.

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

@blindpirate blindpirate deleted the jdk-8296329 branch November 23, 2022 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler compiler-dev@openjdk.org core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

3 participants