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

Error in ASM processing - shadow 2.0.4 - when using relocate #379

Closed
azmras opened this issue May 24, 2018 · 3 comments
Closed

Error in ASM processing - shadow 2.0.4 - when using relocate #379

azmras opened this issue May 24, 2018 · 3 comments

Comments

@azmras
Copy link

azmras commented May 24, 2018

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

Shadow Version

2.0.4

Gradle Version

4.7

Expected Behavior

gradle clean shadowJar // should work (when using relocate), It is working with shadow - 2.0.2

Actual Behavior

gradle clean shadowJar // fails with exception (when using relocate)

> Task :shadowJar FAILED
ex
org.gradle.api.GradleException: Error in ASM processing class org/eclipse/persistence/indirection/IndirectMap.class
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.codehaus.groovy.reflection.CachedConstructor.invoke(CachedConstructor.java:83)
at org.codehaus.groovy.runtime.callsite.ConstructorSite$ConstructorSiteNoUnwrapNoCoerce.callConstructor(ConstructorSite.java:105)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:255)
at com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction$StreamAction.remapClass(ShadowCopyAction.groovy:283)
at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:182)
at com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction$StreamAction.remapClass(ShadowCopyAction.groovy:254)
at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
at com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction$StreamAction.visitArchiveFile(ShadowCopyAction.groovy:232)
.......
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalArgumentException
at shadow.org.objectweb.asm.signature.SignatureReader.parseType(SignatureReader.java:249)
at shadow.org.objectweb.asm.signature.SignatureReader.parseType(SignatureReader.java:240)
at shadow.org.objectweb.asm.signature.SignatureReader.acceptType(SignatureReader.java:140)
at shadow.org.objectweb.asm.commons.Remapper.mapSignature(Remapper.java:161)
at shadow.org.objectweb.asm.commons.MethodRemapper.visitLocalVariable(MethodRemapper.java:212)
at shadow.org.objectweb.asm.ClassReader.readCode(ClassReader.java:2321)
at shadow.org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1238)
at shadow.org.objectweb.asm.ClassReader.accept(ClassReader.java:631)
at shadow.org.objectweb.asm.ClassReader.accept(ClassReader.java:355)
at shadow.org.objectweb.asm.ClassReader$accept.call(Unknown Source)
at com.github.jengelman.gradle.plugins.shadow.tasks.ShadowCopyAction$StreamAction.remapClass(ShadowCopyAction.groovy:281)
... 140 more

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':shadowJar'.
        > Error in ASM processing class org/eclipse/persistence/indirection/IndirectMap.class

Gradle Build Script(s)

plugins {
    id 'java'
    id 'maven'
    id 'com.github.johnrengelman.shadow' version '2.0.4'
}

repositories {
    mavenLocal()
    jcenter()
}

apply plugin: 'com.github.johnrengelman.shadow'

dependencies {
    compile group: 'org.eclipse.persistence', name: 'org.eclipse.persistence.moxy', version: '2.7.1'
    compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
}

shadowJar {
    zip64 true
    relocate 'org.apache.commons.cli', 'shaded.apache.commons.cli'
}
@johnrengelman
Copy link
Owner

Wouldn’t this be an ASM problem?

@azmras
Copy link
Author

azmras commented May 26, 2018

You are right.
I would stick to 2.0.2 for now then, wait for their fix and your next upgrade...
Thanks

@TobiX
Copy link

TobiX commented Jul 24, 2018

I reported a similar issue to the ASM project just yesterday. If you want to debug this issue, maybe rebuild ASM with my change to SignatureReader to get a better understanding why this fails.

Otherwise, if I know where org/eclipse/persistence/indirection/IndirectMap.class is from (EclipseLink?), I could investigate myself (EclipseLink 2.7.2 from Maven Central doesn't exhibit this problem AFAICS).

@azmras azmras closed this as completed Jul 24, 2018
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

3 participants