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

Combination of errorprone-gradle-plugin and options.fork = true causes Java compilation to fail in Gradle 5.5 #9897

Closed
dcabasson opened this issue Jul 8, 2019 · 2 comments
Labels
Milestone

Comments

@dcabasson
Copy link
Contributor

@dcabasson dcabasson commented Jul 8, 2019

Expected Behavior

When using errorprone for java compilation and setting options.fork=true I would expect errorprone to work correctly.
Note that this is working correctly using Gradle 5.4.1

Current Behavior

When using Gradle 5.5 with error prone and options.fork = true errorprone crashes because of a classloading issue:

gradle-errorprone$ gradlew compileJava
Run Gradle /gradle-errorprone/gradlew ...

> Task :compileJava FAILED
compiler message file broken: key=compiler.misc.msg.bug arguments=11.0.2, {1}, {2}, {3}, {4}, {5}, {6}, {7}
java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.toImmutableSet()Ljava/util/stream/Collector;
        at com.google.errorprone.BugCheckerInfo.<init>(BugCheckerInfo.java:119)
        at com.google.errorprone.BugCheckerInfo.create(BugCheckerInfo.java:105)
        at com.google.errorprone.scanner.BuiltInCheckerSuppliers.getSuppliers(BuiltInCheckerSuppliers.java:420)
        at com.google.errorprone.scanner.BuiltInCheckerSuppliers.getSuppliers(BuiltInCheckerSuppliers.java:413)
        at com.google.errorprone.scanner.BuiltInCheckerSuppliers.<clinit>(BuiltInCheckerSuppliers.java:449)
        at com.google.errorprone.ErrorProneJavacPlugin.init(ErrorProneJavacPlugin.java:44)
        at jdk.compiler/com.sun.tools.javac.api.BasicJavacTask.initPlugins(BasicJavacTask.java:215)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.prepareCompiler(JavacTaskImpl.java:199)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:101)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
        at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
        at org.gradle.api.internal.tasks.compile.AnnotationProcessingCompileTask.call(AnnotationProcessingCompileTask.java:92)
        at org.gradle.api.internal.tasks.compile.ResourceCleaningCompilationTask.call(ResourceCleaningCompilationTask.java:57)
        at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:52)
        at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:37)
        at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerCallable.call(AbstractDaemonCompiler.java:99)
        at org.gradle.api.internal.tasks.compile.daemon.AbstractDaemonCompiler$CompilerCallable.call(AbstractDaemonCompiler.java:79)
        at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:44)
        at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:34)
        at org.gradle.workers.internal.FlatClassLoaderWorker.execute(FlatClassLoaderWorker.java:33)
        at org.gradle.workers.internal.WorkerDaemonServer.execute(WorkerDaemonServer.java:55)
        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.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:116)
        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.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
        at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:175)
        at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:157)
        at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:404)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
        at java.base/java.lang.Thread.run(Thread.java:834)

Context

Used to work with 5.4.1. Is now currently broken in 5.5

Steps to Reproduce

See attached project that can reproduce the issue by calling gradlew compileJava. When changing the wrapper version from 5.5 to 5.4.1, everything works as expected.

@dcabasson
Copy link
Contributor Author

@dcabasson dcabasson commented Jul 8, 2019

Minimal project to reproduce the issue:
gradle-9897-errorprone.zip

big-guy added a commit that referenced this issue Jul 8, 2019
ghale pushed a commit that referenced this issue Jul 8, 2019
@big-guy big-guy added this to the 5.5.1 milestone Jul 9, 2019
big-guy added a commit that referenced this issue Jul 9, 2019
* origin/gh/issues/9897:
  Make errorprone smoke test work with Java 8
  Inject a filtering classloader for java annotation processor classpath
  Reproduce #9897
big-guy added a commit that referenced this issue Jul 10, 2019
* origin/release:
  Replace reflection of JavaFileManager with ForwardingJavaFileManager
  Update to 5.5.1 nightly
  Prepare for Gradle 5.5.1
  Add missing property to Task docs
  Make errorprone smoke test work with Java 8
  Inject a filtering classloader for java annotation processor classpath
  Reproduce #9897
  Recognise contribution
  Special case for deferred selector
  fix expectation
  Simplify test
  Failing test
@big-guy
Copy link
Member

@big-guy big-guy commented Jul 10, 2019

This'll be fixed in 5.5.1

@big-guy big-guy closed this as completed Jul 10, 2019
@big-guy big-guy changed the title Errorprone & options.fork = true crashing in Gradle 5.5 Combination of errorprone-gradle-plugin and options.fork = true causes Java compilation to fail in Gradle 5.5 Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants