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

Detect broken MR-JAR files #14

Open
sormuras opened this issue Jul 15, 2019 · 3 comments
Open

Detect broken MR-JAR files #14

sormuras opened this issue Jul 15, 2019 · 3 comments

Comments

@sormuras
Copy link
Collaborator

sormuras commented Jul 15, 2019

For example, when a MR-JAR contains a version 9 directory within its META-INF facility, it shouldn't contain classes that are compiled with --release 10 or higher.

See this broken Java module as a reference: https://repo1.maven.org/maven2/org/lwjgl/lwjgl/3.2.2/lwjgl-3.2.2.jar

In its META-INF/versions/9/ directory are classes reporting bytecode level 54.0 (Java 10):

image

IIRC, jar is not used to create the JAR file. Correct, @Spasi?

@Spasi
Copy link

Spasi commented Jul 16, 2019

Correct, the Ant jar task was used.

@sormuras
Copy link
Collaborator Author

Just uploaded a simple "multi-release JAR" sanity checker tool. Find it here: https://github.com/sormuras/modules/blob/master/src/MultiReleaseCheck.java

  • java MultiReleaseCheck.java org.lwjgl:lwjgl:3.1.6 yields 0, as it isn't a MRJAR
  • java MultiReleaseCheck.java org.lwjgl:lwjgl:3.2.0 yields 1 due to
    Expected 9, but 'META-INF/versions/9/module-info.class' reports: 10 (54)

@sormuras
Copy link
Collaborator Author

sormuras commented Jun 9, 2021

With Java 17, jar supports a --validate option -- see openjdk/jdk#3971 for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants