osundblad / intellij-annotations-instrumenter-maven-plugin

IntelliJ IDEA annotations instrumenter maven plugin
Other
38 stars 11 forks source link

Java 11 Support #29

Closed PeerHeijnen closed 5 years ago

PeerHeijnen commented 6 years ago

Instrumentation fails for a Java 11 build:

Failed to execute goal se.eris:notnull-instrumenter-maven-plugin:0.6.8:instrument (default) on project ....: Execution default of goal se.eris:notnull-instrumenter-maven-plugin:0.6.8:instrument failed: NotNull instrumentation failed for ....: Unsupported class file major version 55 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal se.eris:notnull-instrumenter-maven-plugin:0.6.8:instrument (default) on project ....: Execution default of goal se.eris:notnull-instrumenter-maven-plugin:0.6.8:instrument failed: NotNull instrumentation failed for ....
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        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:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        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.PluginExecutionException: Execution default of goal se.eris:notnull-instrumenter-maven-plugin:0.6.8:instrument failed: NotNull instrumentation failed for ....
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 20 more
Caused by: se.eris.notnull.InstrumentExecutionException: NotNull instrumentation failed for ....
        at com.intellij.NotNullInstrumenter.instrumentFile(NotNullInstrumenter.java:74)
        at com.intellij.NotNullInstrumenter.instrumentDirectoryRecursive(NotNullInstrumenter.java:64)
        at com.intellij.NotNullInstrumenter.addNotNullAnnotations(NotNullInstrumenter.java:57)
        at com.intellij.AbstractNotNullInstrumenterTask.instrument(AbstractNotNullInstrumenterTask.java:77)
        at com.intellij.ClassesNotNullInstrumenter.execute(ClassesNotNullInstrumenter.java:45)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        ... 21 more
Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 55
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:166)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:148)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:136)
        at org.objectweb.asm.ClassReader.<init>(ClassReader.java:237)
        at com.intellij.NotNullInstrumenter.instrumentClass(NotNullInstrumenter.java:80)
        at com.intellij.NotNullInstrumenter.instrumentFile(NotNullInstrumenter.java:72)
        ... 26 more

I tried updating the asm dependency to 6.2.1 or 7.0-beta, which supports Java 11, but this fails with a 'This feature requires ASM7' message (don't know how to fix this).

JWT007 commented 6 years ago

same problem OpenJDK 11.0.1

osundblad commented 5 years ago

I will try to look into this during X-mas. Hopefully it is just that we need to update the asm dependency and add new constants for the new versions (Java 9, 10, and 11).

osundblad commented 5 years ago

I just pushed a PullRequest that could solve the Java 11 issue, please try it out and I'll make a new release.

PS Sorry for not responding earlier, I sadly have very little time to spend on this project nowadays (and few tell me they use it plugin)

osundblad commented 5 years ago

Released version "0.6.9-beta" (as it is quite untested) to maven repos this morning. You cannot see it yet but it is there.

PeerHeijnen commented 5 years ago

Thanks a lot! Will test this.