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 65 #911

Closed
str8y opened this issue Mar 11, 2024 · 7 comments · Fixed by #876
Closed

Unsupported class file major version 65 #911

str8y opened this issue Mar 11, 2024 · 7 comments · Fixed by #876

Comments

@str8y
Copy link

str8y commented Mar 11, 2024

Please check the User Guide before submitting "how do I do 'x'?" questions!

Shadow Version

8.1.1

Gradle Version

8.3

Java Version

17

Expected Behavior

It definitely worked with the same configuration a couple of weeks ago

Actual Behavior

Seems that any of the dependencies was updated to a version built with Java 21 or why does this issue suddenly occurs?

java.lang.IllegalArgumentException: Unsupported class file major version 65
at org.objectweb.asm.ClassReader.(ClassReader.java:199)
at org.objectweb.asm.ClassReader.(ClassReader.java:180)
at org.objectweb.asm.ClassReader.(ClassReader.java:166)
at org.objectweb.asm.ClassReader.(ClassReader.java:287)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:67)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:484)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:72)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:277)
at com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction$StreamAction.remapClass(ShadowCopyAction.groovy:339)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:48)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:189)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:203)
at com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction$StreamAction.remapClass(ShadowCopyAction.groovy:317)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.codehaus.groovy.runtime.callsite.PlainObjectMetaMethodSite.doInvoke(PlainObjectMetaMethodSite.java:48)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:189)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:194)
at com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction$StreamAction.visitArchiveFile(ShadowCopyAction.groovy:286)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:107)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:362)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:61)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:194)
at com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction$StreamAction$_processArchive_closure3.doCall(ShadowCopyAction.groovy:263)

@Goooler
Copy link
Member

Goooler commented Mar 12, 2024

Duplicate of #894

@str8y
Copy link
Author

str8y commented Mar 12, 2024

@Goooler

Are you sure it's a duplicate?
As mentioned, it worked a few weeks ago with exactly the same configuration. I don't want to use Java 21 or a newer gradle version. I just want to understand what was changed, that the current config doesn't work anymore

@Goooler
Copy link
Member

Goooler commented Mar 12, 2024

Your classes are built on Java 21 for now. If you want to pin the byte code level to lower, try to declare sourceCompatibility and targetCompatibility.

@str8y
Copy link
Author

str8y commented Mar 12, 2024

Again, I haven't changed anything in my gradle configuration. What do you mean with "your classes"?
We only use Java 17. My classes are built on Java 17.
sourceCompatibility and targetCompatibility are also set to 17.
The shadow plugin just stopped working without any changes on my side and apparently no changes on the shadow plugin side.
That's why I think it must be one of the used dependencies by the shadow plugin.
With the libraries, that I actually shadow, I don't see a problem, because we are using them anyway in our Java 17 environment.

@Goooler
Copy link
Member

Goooler commented Mar 12, 2024

Your shadowed dependencies may contain Java 21 classes, you can try out my fork to check if it works for you, see #876 (comment). As a workaround, you can also try #876 (comment).

@str8y
Copy link
Author

str8y commented Mar 12, 2024

I will give your fork a try but I still think that the issue is related to a dependency used by the shadow plugin itself.
Because I even get the error when I have something like
shadowJar {
relocate('a', 'b') {}
}

@str8y
Copy link
Author

str8y commented Mar 12, 2024

your fork is working...
I still would be interested in the actual issue though...
:)
Thanks for the help so far

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

Successfully merging a pull request may close this issue.

2 participants