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

Alan Bateman alanb at openjdk.org
Tue Nov 15 12:06:55 UTC 2022


On Tue, 15 Nov 2022 01:52:14 GMT, Bo Zhang <duke at openjdk.org> wrote:

> As described in [JDK-8296329](https://bugs.openjdk.org/browse/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.

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.

-------------

PR: https://git.openjdk.org/jdk/pull/11153


More information about the compiler-dev mailing list