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

Unsupported class file major version 68 error with shading multi-release JAR #1220

Open
dondonz opened this issue Feb 1, 2025 · 2 comments
Labels

Comments

@dondonz
Copy link

dondonz commented Feb 1, 2025

Expected and Results

Hello, first of all thanks for maintaining this excellent library, I really appreciate you continuing the great work and keeping the project going.

I'm a maintainer of GraphQL Java, we have a small Agent tool, which uses ByteBuddy. ByteBuddy is a multi-release JAR.

When I upgrade from ByteBuddy 1.15.11 to 1.16.0, I see an unusual error message "Unsupported class file major version 68", which is odd because GraphQL Java is using Java 11 only, not version 68 (Java 24). You can see the build pipeline with stacktrace: https://github.com/graphql-java/graphql-java/actions/runs/12934658930/job/36076178664

Reproduction If you revert this PR, you can see a reproduction of the error: https://github.com/graphql-java/graphql-java/pull/3799/files

I asked the ByteBuddy folks and they suggested it may be an issue with the Shadow plugin raphw/byte-buddy#1763, however I appreciate this is a tough and unusual edge case, I'm not sure what the cause of the issue is. I saw a similar issue on Jackson, another multi-release JAR: FasterXML/jackson-core#1210. In that thread they suggest excluding META-INF folders (such as the ones containing Java 24 code), but after giving that a try, I still get the same error "Unsupported class file" locally. The same suggestion to exclude META-INF folders is made in this Shadow thread #877 (comment)

I also tried adding Multi-Release: true to the shadow JAR's attributes, the error still persists.

Is there something else I can do to exclude the Java 24 files from the multi-release JAR from the ShadowJar task? I noticed there is an unreleased PR that may target the problem https://github.com/GradleUp/shadow/pull/1200/files. Is it possible to do another beta release and I can test this change?

Thanks!

Related environent and versions

In the PR I tried the latest version of Shadow 8.3.5. I also gave it a try locally with 9.0.0-beta6 and the error persists

Reproduction steps

Reproduction If you revert this PR, you can see a reproduction of the error: https://github.com/graphql-java/graphql-java/pull/3799/files

Anything else?

No response

@dondonz dondonz added the bug label Feb 1, 2025
@Goooler
Copy link
Member

Goooler commented Feb 2, 2025

Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 68
  at org.vafer.jdeb.shaded.objectweb.asm.ClassReader.<init>(ClassReader.java:200)
  at org.vafer.jdeb.shaded.objectweb.asm.ClassReader.<init>(ClassReader.java:180)
  at org.vafer.jdeb.shaded.objectweb.asm.ClassReader.<init>(ClassReader.java:166)
  at org.vafer.jdeb.shaded.objectweb.asm.ClassReader.<init>(ClassReader.java:288)
  ClassReader(byte[] classFileBuffer, int classFileOffset, boolean checkClassVersion) {
      this.classFileBuffer = classFileBuffer;
      this.b = classFileBuffer;
      if (checkClassVersion && this.readShort(classFileOffset + 6) > 67) {
          throw new IllegalArgumentException(stringConcat$0(this.readShort(classFileOffset + 6)));
      } else {
        // ...
      }
  }

ASM 9.7.1 was updated in Jdependency at tcurdt/jdependency#302 but has not been released.

@Goooler
Copy link
Member

Goooler commented Feb 2, 2025

Filed to tcurdt/jdependency#324.

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

No branches or pull requests

2 participants