Skip to content

Unsupported class file major version 65 #911

Closed

Description

@str8y

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)

Activity

  1. Goooler commented on Mar 12, 2024

    @Goooler
    Member

    Duplicate of #894

  2. str8y commented on Mar 12, 2024

    @str8y
    Author

    @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

  3. Goooler commented on Mar 12, 2024

    @Goooler
    Member

    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.

  4. str8y commented on Mar 12, 2024

    @str8y
    Author

    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.

  5. Goooler commented on Mar 12, 2024

    @Goooler
    Member

    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).

  6. str8y commented on Mar 12, 2024

    @str8y
    Author

    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') {}
    }

  7. str8y commented on Mar 12, 2024

    @str8y
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions