google / error-prone

Catch common Java mistakes as compile-time errors
https://errorprone.info
Apache License 2.0
6.87k stars 744 forks source link

Project does not build with JDK 1.8 (final) - java.lang.ClassCastException: com.sun.tools.javac.main.Main$Result cannot be cast to java.lang.Integer #240

Closed cushon closed 10 years ago

cushon commented 10 years ago

Original issue created by raphael.andre.bauer on 2014-03-18 at 09:24 PM


Short description

We are using error-prone (latest 1.1.1) in some of our open source maven projects. We just tried to build our project with the final fancy 1.8.0 JDK, but we are getting an error. Removing error prone "fixes" the issue. It also works perfectly fine with the old series 7 JDK.

Thanks for your efforts and looking into this!

The relevant error message is

java.lang.ClassCastException: com.sun.tools.javac.main.Main$Result cannot be cast to java.lang.Integer

coming from: org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:538)

(Full stack trace below).

My environment

Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T18:37:52+01:00) Maven home: /Users/user/applications/apache-maven Java version: 1.8.0, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.7.5", arch: "x86_64", family: "mac"

error-prone libraries and compiler versions

<plugin>                     <groupId>org.apache.maven.plugins</groupId>                     <artifactId>maven-compiler-plugin</artifactId>                     <version>3.1</version>                     <configuration>                         <source>1.7</source>                         <target>1.7</target>                         <compilerId>javac-with-errorprone</compilerId>                         <forceJavacCompilerUse>true</forceJavacCompilerUse>                     </configuration>                     <dependencies>                         <dependency>                             <groupId>com.google.errorprone</groupId>                             <artifactId>error_prone_core</artifactId>                             <version>1.1.1</version>                         </dependency>                         <dependency>                             <groupId>org.codehaus.plexus</groupId>                             <artifactId>plexus-compiler-javac</artifactId>                             <version>2.3</version>                         </dependency>                         <dependency>                             <groupId>org.codehaus.plexus</groupId>                             <artifactId>plexus-compiler-javac-errorprone</artifactId>                             <version>2.3</version>                         </dependency>                     </dependencies>                 </plugin>

Project to reproduce problem:

Open source project at https://github.com/ninjaframework/ninja - tag ninja-3.1.2

(Full stack trace)

Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling     at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:796)     at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)     ... 19 more Caused by: java.lang.ClassCastException: com.sun.tools.javac.main.Main$Result cannot be cast to java.lang.Integer     at org.codehaus.plexus.compiler.javac.errorprone.JavacCompilerWithErrorProne.compileInProcessWithProperClassloader(JavacCompilerWithErrorProne.java:180)     at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:538)     at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)     at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:785)     ... 22 more

cushon commented 10 years ago

Original comment posted by raphael.andre.bauer on 2014-03-19 at 01:49 PM


Seems to be related to this one: http://jira.codehaus.org/browse/MCOMPILER-217

cushon commented 10 years ago

Original comment posted by eaftan@google.com on 2014-04-07 at 10:07 PM


(No comment entered for this change.)


Status: Duplicate Merged Into: #246