Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Workaround for JDK8/Maven bug? #151

Closed
dminkovsky opened this issue May 4, 2016 · 12 comments
Closed

Workaround for JDK8/Maven bug? #151

dminkovsky opened this issue May 4, 2016 · 12 comments

Comments

@dminkovsky
Copy link

I am affected by this JDK8 bug with annotation processing. When I attempt to build my project without cleaning first, I get:

[INFO] Compiling 22 source files to /Users/dmitry/dev/project/stream/target/classes
An exception has occurred in the compiler (1.8.0_74). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.j
ava.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.IllegalStateException: endPosTable already set
        at com.sun.tools.javac.util.DiagnosticSource.setEndPosTable(DiagnosticSource.java:136)
        at com.sun.tools.javac.util.Log.setEndPosTable(Log.java:350)

This is forcing me to clean my build every time I want to compile. I'd like to be able to build without cleaning. Does anyone know a workaround for this issue?

@alicederyn
Copy link
Collaborator

Are you using Maven, as in the bug description?

On Wed, 4 May 2016, 19:05 Dmitry Minkovsky, notifications@github.com
wrote:

I am affected by this JDK8 bug with annotation processing
https://bugs.openjdk.java.net/browse/JDK-8067747. When I attempt to
build my project without cleaning first, I get:

[INFO] Compiling 22 source files to /Users/dmitry/dev/project/stream/target/classes
An exception has occurred in the compiler (1.8.0_74). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.IllegalStateException: endPosTable already set
at com.sun.tools.javac.util.DiagnosticSource.setEndPosTable(DiagnosticSource.java:136)
at com.sun.tools.javac.util.Log.setEndPosTable(Log.java:350)

This is forcing me to clean my build every time I want to compile. I'd
like to be able to build without cleaning. Does anyone know a workaround
for this issue?


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#151

@dminkovsky
Copy link
Author

I am. Version 3.3.3. A gist with my pom.xml https://gist.github.com/dminkovsky/edd89c757d7c1f1d9c2ccfaf4e9ed34e

@alicederyn
Copy link
Collaborator

Is that the full stack trace you're seeing?

@dminkovsky
Copy link
Author

Here is the full trace:

[INFO] Compiling 22 source files to /Users/dmitry/dev/project/stream/target/classes                                                                                                                   [26/1888]
An exception has occurred in the compiler (1.8.0_74). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.j
ava.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.IllegalStateException: endPosTable already set
        at com.sun.tools.javac.util.DiagnosticSource.setEndPosTable(DiagnosticSource.java:136)
        at com.sun.tools.javac.util.Log.setEndPosTable(Log.java:350)
        at com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:667)
        at com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:950)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.<init>(JavacProcessingEnvironment.java:892)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.next(JavacProcessingEnvironment.java:921)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1187)
        at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1170)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:856)
        at com.sun.tools.javac.main.Main.compile(Main.java:523)
        at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
        at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
        at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:125)
        at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:171)
        at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:886)
        at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        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:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        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)
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] An unknown compilation problem occurred
[INFO] 1 error
[INFO] -------------------------------------------------------------

@alicederyn
Copy link
Collaborator

Thanks. Unfortunately there doesn't seem to be any FreeBuilder in that trace, so there's no obvious way we could change the processor to avoid triggering the error in the first place, which we normally do for this kind of bug.

@dminkovsky
Copy link
Author

That's what I feared. I posted thinking maybe someone else might know or find an answer? Others must surely be using JDK8?

@alicederyn
Copy link
Collaborator

It seems to be a Maven bug, though. We've used JDK8 for a while with no problems using Gradle, Eclipse and IntelliJ.

@alicederyn alicederyn changed the title Workaround for JDK8 bug? Workaround for JDK8/Maven bug? May 5, 2016
@dminkovsky
Copy link
Author

I configured an IntelliJ build and, yeah, this does not occur. So, Maven related.

@alicederyn
Copy link
Collaborator

My best suggestion is to switch to Gradle. As a bonus, with gradle-processors you can correctly configure IntelliJ and Eclipse to use annotation processors with a single command-line call (gradle idea or gradle eclipse, or just open the Gradle project directly in IntelliJ).

@dminkovsky
Copy link
Author

@ChrisAlice Thank you. Yeah, that's what I'm probably going to do eventually when I have a minute. But I've got it working in IntelliJ. I was enjoying building and running from the command line, but since IntelliJ was already configured to import my Maven model, when I ran into this problem I just started building from the IDE and everything has been fine. I'd rather not do everything from the IDE because it's not the best feeling for me but it's working now, so... :D

@dminkovsky
Copy link
Author

Hey I am glad to report user error in this issue.

For some reason I had needlessly configured build-helper-maven-plugin to add the generated sources to the class path (as in example). No problems recompiling with this plugin removed.

Thank you.

@alicederyn
Copy link
Collaborator

Thanks for the update, Dmitry!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants