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

IntelliJ fails to build GJF due to ErrorProne+Java8 #417

Open
cgrushko opened this issue Nov 12, 2019 · 6 comments
Open

IntelliJ fails to build GJF due to ErrorProne+Java8 #417

cgrushko opened this issue Nov 12, 2019 · 6 comments

Comments

@cgrushko
Copy link
Contributor

Repro:

  1. Load the pom.xml file in IntelliJ
  2. Attempt to run tests inside IntelliJ

Observe:

Information:java: An exception has occurred in the compiler (1.8.0_181). 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.
Information:java:   at com.sun.tools.javac.main.Main.compile(Main.java:473)
Information:java:   at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
Information:java:   at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
Information:java:   at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:190)
Information:java:   at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:459)
Information:java:   at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:329)
Information:java:   at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:254)
Information:java:   at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:212)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1328)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1008)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1075)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:969)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:798)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:380)
Information:java:   at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:178)
Information:java:   at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:139)
Information:java:   at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302)
Information:java:   at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:135)
Information:java:   at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:228)
Information:java:   at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
Information:java:   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
Information:java:   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
Information:java:   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
Information:java:   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
Information:java:   at java.lang.Thread.run(Thread.java:748)
Information:java:   at com.sun.tools.javac.main.Main.compile(Main.java:470)
Information:java:   ... 24 more
Information:java: Errors occurred while compiling module 'google-java-format'
Information:javac 1.8.0_181 was used to compile java sources
Information:2019-11-12 12:08 - Build completed with 4 errors and 1 warning in 2 s 838 ms
Error:java: java.lang.RuntimeException: java.lang.NoSuchMethodError: com.sun.tools.javac.util.JavacMessages.add(Lcom/sun/tools/javac/util/JavacMessages$ResourceBundleHelper;)V
Error:java: Caused by: java.lang.NoSuchMethodError: com.sun.tools.javac.util.JavacMessages.add(Lcom/sun/tools/javac/util/JavacMessages$ResourceBundleHelper;)V
Error:java:     at com.google.errorprone.BaseErrorProneJavaCompiler.setupMessageBundle(BaseErrorProneJavaCompiler.java:202)
Error:java:     at com.google.errorprone.ErrorProneJavacPlugin.init(ErrorProneJavacPlugin.java:40)

System information:

image

Things to note -

  1. mvn install succeeds in building GJF.
  2. The IntelliJ project was created from pom.xml

Workaround -

  1. The problem goes away if I remove the compiler parameters in IntelliJ (bottom of Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler)
@cushon
Copy link
Collaborator

cushon commented Nov 14, 2019

It looks like this configuration isn't getting pick up:

<arg>-J-Xbootclasspath/p:${settings.localRepository}/com/google/errorprone/javac/${javac.version}/javac-${javac.version}.jar</arg>

The easiest work-around might be to run on JDK 11.

@tbroyer
Copy link
Contributor

tbroyer commented Nov 14, 2019

Would it work with IntelliJ's ErrorProne plugin?

@cgrushko
Copy link
Contributor Author

cgrushko commented Nov 14, 2019 via email

@cushon
Copy link
Collaborator

cushon commented Nov 20, 2019

You could also try manually activating the jdk8 maven profile in IntelliJ (https://www.jetbrains.com/help/idea/work-with-maven-profiles.html#activate_maven_profiles).

@cushon
Copy link
Collaborator

cushon commented Dec 19, 2019

Did enabling the jdk8 profile make a difference?

@cgrushko
Copy link
Contributor Author

Enabling the jdk8 profile didn't help, the error remains (the profile was enabled by default for me)
(Sorry for the delay)

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