Hi everybody,
I'm writing some example code to learn Error Prone features. Currently I'm following
https://github.com/google/error-prone/wiki/Writing-a-check to write my custom checks. Unfortunately I'm not able to unit test these checks because my test setup is raising a java.lang.NoSuchFieldError: ANNOTATION_PROCESSOR_MODULE_PATH. I debugged and found that this exception comes from StandardLocation.java that is present on rt.jar (1.8) and com.google.errorprone:javac:9+181-r4173-1 (and the classpath probably should load it from javac:9+181-r4173-1)
Any ideas on that?
JVM: 1.8.0_161 (Oracle Corporation 25.161-b12)
Error Prone: 2.2.0
Gradle: 4.5
Code:
https://github.com/rafaelpsouza/errorprone-spikes/tree/master/custom-checkersStack trace:
java.lang.NoSuchFieldError: ANNOTATION_PROCESSOR_MODULE_PATH
at com.sun.tools.javac.file.Locations.initHandlers(Locations.java:1976)
at com.sun.tools.javac.file.Locations.<init>(Locations.java:145)
at com.sun.tools.javac.file.BaseFileManager.createLocations(BaseFileManager.java:115)
at com.sun.tools.javac.file.BaseFileManager.<init>(BaseFileManager.java:76)
at com.sun.tools.javac.file.JavacFileManager.<init>(JavacFileManager.java:147)
at com.google.errorprone.ErrorProneInMemoryFileManager.<init>(ErrorProneInMemoryFileManager.java:66)
at com.google.errorprone.ErrorProneInMemoryFileManager.<init>(ErrorProneInMemoryFileManager.java:62)
at com.google.errorprone.CompilationTestHelper.<init>(CompilationTestHelper.java:76)
at com.google.errorprone.CompilationTestHelper.newInstance(CompilationTestHelper.java:115)
at br.eng.rafaelpsouza.errorprone.DoNotReturnNullTest.setup(DoNotReturnNullTest.java:19)
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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)