2.2.0 (latest)
I'm writing a new Gradle plugin that integrates Error Prone as a JavaC plugin rather than relying on internal Gradle APIs: https://github.com/tbroyer/gradle-errorprone-javacplugin-plugin/ and came across this issue while writing more tests; but this can be reproduced on the command-line.
If possible, provide a recipe for reproducing the error.
A complete small program is good.
/usr/lib/jvm/java-9-openjdk/bin/javac -processorpath error_prone_ant-2.2.0.jar:nullaway-0.4.0.jar -Xplugin:ErrorProne Foo.java
Class Foo should be compiled without error (or with Error Prone violations if any)
Compilation fails with exception while trying to load the custom check; likely a classloader issue:
An exception has occurred in the compiler (9.0.4). 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.
java.util.ServiceConfigurationError: com.google.errorprone.bugpatterns.BugChecker: com.uber.nullaway.NullAway not a subtype
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:588)
at java.base/java.util.ServiceLoader.access$200(ServiceLoader.java:390)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1231)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1259)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1294)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1379)
at com.google.common.collect.Iterables.isEmpty(Iterables.java:1059)
at com.google.errorprone.ErrorPronePlugins.loadPlugins(ErrorPronePlugins.java:49)
at com.google.errorprone.ErrorProneAnalyzer.lambda$scansPlugins$0(ErrorProneAnalyzer.java:76)
at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:160)
at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:152)
at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:120)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1404)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1363)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:959)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:302)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:162)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
JavaFileManager.getServiceLoader when used with Java 9+? Or should it be seen as a JavaC bug? (tested in OpenJDK 9.0.4 and Oracle JDK 10, both exhibit the issue)I see that it was supposedly fixed in 2.2.0 by 3e44e106f9006eefe7ab16bc993aa245d59c9462, but I double-checked and confirm that I reproduce the issue with 2.2.0 (with and without the -J--add-exports=)
I see that it was supposedly fixed in 2.2.0 by 3e44e10
3e44e10 didn't make it into 2.2.0, though. It works for me at head:
$ javac -fullversion -processorpath error_prone_ant-2.2.0.jar:nullaway-0.4.1.jar '-Xplugin:ErrorProne -XepOpt:NullAway:AnnotatedPackages=test' -XDcompilePolicy=byfile Foo.java
javac full version "9.0.4+11"
An exception has occurred in the compiler (9.0.4). 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.
java.util.ServiceConfigurationError: com.google.errorprone.bugpatterns.BugChecker: com.uber.nullaway.NullAway not a subtype
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:588)
at java.base/java.util.ServiceLoader.access$200(ServiceLoader.java:390)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1231)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1259)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1294)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1379)
at com.google.common.collect.Iterables.isEmpty(Iterables.java:1059)
at com.google.errorprone.ErrorPronePlugins.loadPlugins(ErrorPronePlugins.java:49)
at com.google.errorprone.ErrorProneAnalyzer.lambda$scansPlugins$0(ErrorProneAnalyzer.java:76)
at com.google.common.base.Suppliers$NonSerializableMemoizingSupplier.get(Suppliers.java:160)
at com.google.errorprone.ErrorProneAnalyzer.finished(ErrorProneAnalyzer.java:152)
at jdk.compiler/com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:120)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1404)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1353)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:952)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:302)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:162)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
$ javac -fullversion -processorpath error_prone_ant-2.2.1-
20180327.021500-39.jar:nullaway-0.4.1.jar '-Xplugin:ErrorProne -XepOpt:NullAway:AnnotatedPackages=test' -XDcompilePolicy=byfile Foo.java
javac full version "9.0.4+11"
Foo.java:4: warning: [NullAway] returning @Nullable expression from method with @NonNull return type
return null;
^
(see http://t.uber.com/nullaway )
1 warning
3e44e10 didn't make it into 2.2.0, though.
Ha, must have misread my gitk, thanks (and indeed commit was 10 days after 2.2.0 release).
Any ETA for 2.2.1?
I'm on the hook for 2.2.1, but I'm swamped through 4/6. So let's say the week of 4/9-13.
Snoozed the mail notification until then, will ping you if you're "late" :wink:
2.3.0 has been released with the fix on 19 Apr, and then 2.3.1 on 21 Apr.
Most helpful comment
I'm on the hook for 2.2.1, but I'm swamped through 4/6. So let's say the week of 4/9-13.