Repository: kythe/kythe (language: rust)

Issue:
Bazel CI: Kythe is failing in downstream with Bazel@HEAD - Error Prone
https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/2856#01862f36-b9c9-416b-81dc-a9a5c0ff2dc3

```
(04:14:07) ERROR: /var/lib/buildkite-agent/builds/bk-docker-222l/bazel-downstream-projects/kythe/kythe/java/com/google/devtools/kythe/extractors/shared/BUILD:35:13: Building kythe/java/com/google/devtools/kythe/extractors/shared/libfile_vnames.jar (1 source file) failed: (Exit 1): java failed: error executing command (from target //kythe/java/com/google/devtools/kythe/extractors/shared:file_vnames)
--
  | (cd /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/0d48e037abb2184fadf94785455d1155/execroot/io_kythe && \
  | exec env - \
  | LC_CTYPE=en_US.UTF-8 \
  | PATH=/bin:/usr/bin:/usr/local/bin \
  | external/remotejdk17_linux/bin/java '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.resources=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED' '--add-opens=java.base/java.nio=ALL-UNNAMED' '--add-opens=java.base/java.lang=ALL-UNNAMED' '-Dsun.io.useCanonCaches=false' -XX:-CompactStrings -jar external/remote_java_tools/java_tools/JavaBuilder_deploy.jar @bazel-out/k8-fastbuild/bin/kythe/java/com/google/devtools/kythe/extractors/shared/libfile_vnames.jar-0.params @bazel-out/k8-fastbuild/bin/kythe/java/com/google/devtools/kythe/extractors/shared/libfile_vnames.jar-1.params)
  | # Configuration: dfc7da9c2e0f38ef6c6132bdb907cd347f7d84a79d1b8116658f09144e419883
  | # Execution platform: @local_config_platform//:host
  | kythe/java/com/google/devtools/kythe/extractors/shared/FileVNames.java:235: error: [UnusedMethod] Method 'fillInWith' is never used.
  | public VName fillInWith(Matcher m, String defaultCorpus) {
  | ^
  | (see https://errorprone.info/bugpattern/UnusedMethod)
  | Did you mean to remove this line?
  | (04:14:07) INFO: Elapsed time: 75.821s, Critical Path: 13.01s
  | (04:14:07) INFO: 14491 processes: 7095 remote cache hit, 7258 internal, 20 linux-sandbox, 111 local, 7 worker.
  | (04:14:07) ERROR: Build did NOT complete successfully
  | bazel build failed with exit code 1
  | 🚨 Error: The command exited with status 1
```


Discussion / hints:
Why is ErrorProne triggering on an unused `public` method? It seems like it shouldn't expect to *see* all uses of a public method.
Nevermind, looks like it's a public method on a private class :-)
Thanks for the fix!
We're now seeing this issue come up. Could you please check/reopen? Happy to open a new issue if needed. 
```
(04:08:16) ERROR: /var/lib/buildkite-agent/builds/bk-docker-4n12/bazel-downstream-projects/kythe/kythe/java/com/google/devtools/kythe/platform/shared/filesystem/BUILD:5:13: Building kythe/java/com/google/devtools/kythe/platform/shared/filesystem/libfilesystem.jar (4 source files) failed: (Exit 1): java failed: error executing command (from target //kythe/java/com/google/devtools/kythe/platform/shared/filesystem:filesystem)
--
  | (cd /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/65725ee81c1258e95c5a4dff94d066ba/execroot/io_kythe && \
  | exec env - \
  | LC_CTYPE=en_US.UTF-8 \
  | PATH=/bin:/usr/bin:/usr/local/bin \
  | external/remotejdk17_linux/bin/java '--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.resources=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED' '--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED' '--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED' '--add-opens=java.base/java.nio=ALL-UNNAMED' '--add-opens=java.base/java.lang=ALL-UNNAMED' '-Dsun.io.useCanonCaches=false' -XX:-CompactStrings -jar external/remote_java_tools/java_tools/JavaBuilder_deploy.jar @bazel-out/k8-fastbuild/bin/kythe/java/com/google/devtools/kythe/platform/shared/filesystem/libfilesystem.jar-0.params @bazel-out/k8-fastbuild/bin/kythe/java/com/google/devtools/kythe/platform/shared/filesystem/libfilesystem.jar-1.params)
  | # Configuration: 7b82de157c1bff7041106ddd7ebb286b843f7daa1fa313919ea9cbc6f348c549
  | # Execution platform: @local_config_platform//:host
  | kythe/java/com/google/devtools/kythe/platform/shared/filesystem/CompilationUnitFileAttributes.java:72: error: [ReturnMissingNullable] Method returns a definitely null value but is not annotated @Nullable
  | return null;
  | ^
  | (see https://errorprone.info/bugpattern/ReturnMissingNullable)
  | Did you mean 'public @Nullable Object fileKey() {'?
  | (04:08:16) INFO: Elapsed time: 74.290s, Critical Path: 10.81s
  | (04:08:16) INFO: 14442 processes: 7060 remote cache hit, 7259 internal, 11 linux-sandbox, 111 local, 1 worker.
  | (04:08:16) ERROR: Build did NOT complete successfully
  | bazel build failed with exit code 1
  | 🚨 Error: The command exited with status 1
```
While we should enable those checks ourselves, I don't think it's sustainable for either of us if the set of checks you use when compiling Kythe is larger than the set we use.
@keertk Are the failing ErrorProne checks something you've explicitly enabled? Can you point me at that configuration so we can enable them locally rather than relying on you for the reports?
It looks like this is only firing with the HEAD version of Bazel, which suggests something has changed there wrt error prone.

Fix patch:
diff --git a/kythe/java/com/google/devtools/kythe/platform/shared/filesystem/CompilationUnitFileAttributes.java b/kythe/java/com/google/devtools/kythe/platform/shared/filesystem/CompilationUnitFileAttributes.java
index 02bb32e7b0..e8f1f382e3 100644
--- a/kythe/java/com/google/devtools/kythe/platform/shared/filesystem/CompilationUnitFileAttributes.java
+++ b/kythe/java/com/google/devtools/kythe/platform/shared/filesystem/CompilationUnitFileAttributes.java
@@ -18,6 +18,7 @@
 
 import java.nio.file.attribute.BasicFileAttributes;
 import java.nio.file.attribute.FileTime;
+import org.checkerframework.checker.nullness.qual.Nullable;
 
 /** {@link BasicFileAttributes} implementation for {@link CompilationUnitFileSystem}. */
 final class CompilationUnitFileAttributes implements BasicFileAttributes {
@@ -68,7 +69,7 @@ public long size() {
   }
 
   @Override
-  public Object fileKey() {
+  public @Nullable Object fileKey() {
     return null;
   }
 }


Test patch: