Created by: kageiit
This makes source based abi generation compatible with the error prone java compiler.
Key aspect is to not assume the CompilationTask
will be an instance of JavacTask
as that assumption is not really required. Without this change, compiling with error prone fails with
Could not load source-generated ABI validator. Your compiler might not support this. If it doesn't, you may need to disable source-based ABI generation.
com.facebook.buck.util.HumanReadableException: Could not load source-generated ABI validator. Your compiler might not support this. If it doesn't, you may need to disable source-based ABI generation.
at com.facebook.buck.jvm.java.abi.SourceBasedAbiStubber.newValidatingTaskListener(SourceBasedAbiStubber.java:50)
at com.facebook.buck.jvm.java.Jsr199Javac.buildWithClasspath(Jsr199Javac.java:260)
at com.facebook.buck.jvm.java.Jsr199Javac.buildWithClasspath(Jsr199Javac.java:155)
at com.facebook.buck.jvm.java.JavacStep.performBuild(JavacStep.java:194)
at com.facebook.buck.jvm.java.JavacStep.tryBuildWithFirstOrderDeps(JavacStep.java:184)
at com.facebook.buck.jvm.java.JavacStep.execute(JavacStep.java:145)
at com.facebook.buck.jvm.java.JavacDirectToJarStep.execute(JavacDirectToJarStep.java:94)
at com.facebook.buck.step.DefaultStepRunner.runStepForBuildTarget(DefaultStepRunner.java:47)
at com.facebook.buck.rules.CachingBuildEngine.executeCommandsNowThatDepsAreBuilt(CachingBuildEngine.java:1507)
at com.facebook.buck.rules.CachingBuildEngine.lambda$15(CachingBuildEngine.java:350)
at com.facebook.buck.util.concurrent.WeightedListeningExecutorService.lambda$0(WeightedListeningExecutorService.java:81)
at com.google.common.util.concurrent.AbstractTransformFuture$AsyncTransformFuture.doTransform(AbstractTransformFuture.java:211)
at com.google.common.util.concurrent.AbstractTransformFuture$AsyncTransformFuture.doTransform(AbstractTransformFuture.java:200)
at com.google.common.util.concurrent.AbstractTransformFuture.run(AbstractTransformFuture.java:130)
at com.google.common.util.concurrent.MoreExecutors$5$1.run(MoreExecutors.java:988)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at com.facebook.buck.jvm.java.abi.SourceBasedAbiStubber.newValidatingTaskListener(SourceBasedAbiStubber.java:48)
... 17 more
Caused by: java.lang.ClassCastException: com.google.errorprone.BaseErrorProneJavaCompiler$1 cannot be cast to com.sun.source.util.JavacTask
at com.facebook.buck.jvm.java.abi.source.ValidatingTaskListener.<init>(ValidatingTaskListener.java:53)
... 22 more
With this change, compilation proceeds as normal and shows abi from source generation migration warnings as expected