maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yegor Borovikov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (MSHADE-243) Java 8 type-use annotation breaks relocation
Date Fri, 02 Dec 2016 18:39:58 GMT
Yegor Borovikov created MSHADE-243:
--------------------------------------

             Summary: Java 8 type-use annotation breaks relocation
                 Key: MSHADE-243
                 URL: https://issues.apache.org/jira/browse/MSHADE-243
             Project: Maven Shade Plugin
          Issue Type: Bug
    Affects Versions: 2.4.3
            Reporter: Yegor Borovikov


When relocation tries to examine a class with type-use annotation for remapping it fails in
{{org.objectweb.asm.ClassReader.readLabel()}} (in some cases).

This code can be used to reproduce the issue:
{code:java}
import org.jetbrains.annotations.Nullable;

interface Foo<V> { void foo(V x); }

class FooImpl implements Foo<Iterable<Object>> {
    public void foo(Iterable<Object> result) {
        if ("".equals(null)) {
            @Nullable Object o = null;
            o = null; // without a statement here errs at offset 65535 instead of 11
        }
    }
}
{code}

Running {{mvn package}} (with {{<relocation>}} in shade configuration) yields:

{code}
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.4.3:shade (default)
on project asm-bug: Error creating shaded jar: Error in ASM processing class FooImpl.class:
11 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.4.3:shade
(default) on project asm-bug: Error creating shaded jar: Error in ASM processing class FooImpl.class
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating shaded jar: Error
in ASM processing class FooImpl.class
	at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:540)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
	... 20 more
Caused by: org.apache.maven.plugin.MojoExecutionException: Error in ASM processing class FooImpl.class
	at org.apache.maven.plugins.shade.DefaultShader.addRemappedClass(DefaultShader.java:450)
	at org.apache.maven.plugins.shade.DefaultShader.shadeSingleJar(DefaultShader.java:219)
	at org.apache.maven.plugins.shade.DefaultShader.shadeJars(DefaultShader.java:179)
	at org.apache.maven.plugins.shade.DefaultShader.shade(DefaultShader.java:104)
	at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:454)
	... 22 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 11
	at org.objectweb.asm.ClassReader.readLabel(Unknown Source)
	at org.objectweb.asm.ClassReader.a(Unknown Source)
	at org.objectweb.asm.ClassReader.a(Unknown Source)
	at org.objectweb.asm.ClassReader.b(Unknown Source)
	at org.objectweb.asm.ClassReader.accept(Unknown Source)
	at org.objectweb.asm.ClassReader.accept(Unknown Source)
	at org.apache.maven.plugins.shade.DefaultShader.addRemappedClass(DefaultShader.java:446)
	... 26 more
{code}

Related ASM issue: [#317778|https://forge.ow2.org/tracker/?func=detail&aid=317778&group_id=23&atid=100023].



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message