Repository: bazelbuild/bazel
Issue: java_tools release broken
Labels: P1
team-Rules-Java

### Description of the problem:

java_tools release probably broke a couple of Java projects (with Dagger?)

See for a full list of breakages in downstream:
https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1234#a822417e-f2f7-4927-abe7-b01289011f67
(Note that it includes more problems than this particular issue.)

One example:
https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1234#83e0dae2-b545-413c-9311-56b79320a2b6

Example error:
```
ERROR: /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/ecf942666dab041fc60b1286a219db3e/external/io_bazel_rules_kotlin/src/main/kotlin/io/bazel/kotlin/builder/BUILD:34:1: Couldn't build file external/io_bazel_rules_kotlin/src/main/kotlin/io/bazel/kotlin/builder/libbuilder.jar: Building external/io_bazel_rules_kotlin/src/main/kotlin/io/bazel/kotlin/builder/libbuilder.jar (2 source files) and running annotation processors (ComponentProcessor) failed (Exit 1)
--
  | bazel-out/host/bin/external/io_bazel_rules_kotlin/src/main/kotlin/io/bazel/kotlin/builder/_javac/builder/libbuilder_sourcegenfiles/io/bazel/kotlin/builder/KotlinBuilderComponent_Module_ProvidePluginArgEncoderFactory.java:23: error: [RefersToDaggerCodegen] Don't refer to Dagger's internal or generated code
  | return providePluginArgEncoder(module, toolchainProvider.get());
  | ^
  | (see https://errorprone.info/bugpattern/RefersToDaggerCodegen)
  | bazel-out/host/bin/external/io_bazel_rules_kotlin/src/main/kotlin/io/bazel/kotlin/builder/_javac/builder/libbuilder_sourcegenfiles/io/bazel/kotlin/builder/KotlinBuilderComponent_Module_ProvidePluginArgEncoderFactory.java:33: error: [RefersToDaggerCodegen] Don't refer to Dagger's internal or generated code
  | return Preconditions.checkNotNull(instance.providePluginArgEncoder(toolchain), "Cannot return null from a non-@Nullable @Provides method");
  | ^
  | (see https://errorprone.info/bugpattern/RefersToDaggerCodegen)
```

### What's the output of `bazel info release`?

This is with the 1.1.0rc1


Issue comments:
cc @hlopko who created the release
It looks related to the error prone upgrade in https://github.com/bazelbuild/bazel/pull/9372, I'm rebuilding the tools and update this thread when I confirm the culprit.
@meisterT I can confirm the error prone upgrade to 2.3.3 is the culprit. The new error prone release introduced new error prone checks. This should have been an incompatible change. @cushon FYI

Next steps:
1. revert d990746fbd74334aee195dbdb2f6658f30108113
2. create java_tools patch release v6.1
3. upgrade the default java_tools in bazel to v6.1
4. cherry-pick commit for step 3 into bazel 1.1
This should be fixed by 0a8071af47223989e9ba335e63b8a9595fe6f10f.

Pull request review comments:

Patch that resolved the issue:
diff --git a/WORKSPACE b/WORKSPACE
index d905b52ee1e339..b53508d82aa81b 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -119,9 +119,9 @@ distdir_tar(
     archives = [
         "e0b0291b2c51fbe5a7cfa14473a1ae850f94f021.zip",
         "f83cb8dd6f5658bc574ccd873e25197055265d1c.tar.gz",
-        "java_tools_javac11_linux-v6.0.zip",
-        "java_tools_javac11_windows-v6.0.zip",
-        "java_tools_javac11_darwin-v6.0.zip",
+        "java_tools_javac11_linux-v6.1.zip",
+        "java_tools_javac11_windows-v6.1.zip",
+        "java_tools_javac11_darwin-v6.1.zip",
         "coverage_output_generator-v2.0.zip",
         "c7bbde2950769aac9a99364b0926230060a3ce04.tar.gz",
         "8ccf4f1c351928b55d5dddf3672e3667f6978d60.tar.gz",
@@ -144,9 +144,9 @@ distdir_tar(
     sha256 = {
         "e0b0291b2c51fbe5a7cfa14473a1ae850f94f021.zip": "fe2e04f91ce8c59d49d91b8102edc6627c6fa2906c1b0e7346f01419ec4f419d",
         "f83cb8dd6f5658bc574ccd873e25197055265d1c.tar.gz": "ba5d15ca230efca96320085d8e4d58da826d1f81b444ef8afccd8b23e0799b52",
-        "java_tools_javac11_linux-v6.0.zip": "37acb8380b1dd6c31fd27a19bf3da821c9b02ee93c6163fce36f070a806516b5",
-        "java_tools_javac11_windows-v6.0.zip": "384e138ca58842ea563fb7efbe0cb9c5c381bd4de1f6a31f0256823325f81ccc",
-        "java_tools_javac11_darwin-v6.0.zip": "5a9f320c33424262e505151dd5c6903e36678a0f0bbdaae67bcf07f41d8c7cf3",
+        "java_tools_javac11_linux-v6.1.zip": "12f7940ed0bc4c2e82238951cdf19b4179c7dcc361d16fe40fe4266538fb4ac6",
+        "java_tools_javac11_windows-v6.1.zip": "e2deb2efff684de78787e0bdc7620f9672d13f04a12856d8e7f677369a8e286b",
+        "java_tools_javac11_darwin-v6.1.zip": "f0c488dac18f18ab1a0d18bbd65288c7a128e90a24d9c16f65bd8243f79483a0",
         "coverage_output_generator-v2.0.zip": "3a6951051272d51613ac4c77af6ce238a3db321bf06506fde1b8866eb18a89dd",
         "c7bbde2950769aac9a99364b0926230060a3ce04.tar.gz": "e6a76586b264f30679688f65f7e71ac112d1446681010a13bf22d9ca071f34b7",
         "8ccf4f1c351928b55d5dddf3672e3667f6978d60.tar.gz": "d868ce50d592ef4aad7dec4dd32ae68d2151261913450fac8390b3fd474bb898",
@@ -174,14 +174,14 @@ distdir_tar(
             "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/archive/f83cb8dd6f5658bc574ccd873e25197055265d1c.tar.gz",
             "https://github.com/bazelbuild/bazel-skylib/archive/f83cb8dd6f5658bc574ccd873e25197055265d1c.tar.gz",
         ],
-        "java_tools_javac11_linux-v6.0.zip": [
-            "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_linux-v6.0.zip",
+        "java_tools_javac11_linux-v6.1.zip": [
+            "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.1/java_tools_javac11_linux-v6.1.zip",
         ],
-        "java_tools_javac11_windows-v6.0.zip": [
-            "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_windows-v6.0.zip",
+        "java_tools_javac11_windows-v6.1.zip": [
+            "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.1/java_tools_javac11_windows-v6.1.zip",
         ],
-        "java_tools_javac11_darwin-v6.0.zip": [
-            "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_darwin-v6.0.zip",
+        "java_tools_javac11_darwin-v6.1.zip": [
+            "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.1/java_tools_javac11_darwin-v6.1.zip",
         ],
         "coverage_output_generator-v2.0.zip": [
             "https://mirror.bazel.build/bazel_coverage_output_generator/releases/coverage_output_generator-v2.0.zip",
@@ -497,9 +497,9 @@ distdir_tar(
         "zulu10.2+3-jdk10.0.1-macosx_x64-allmodules.tar.gz",
         "zulu10.2+3-jdk10.0.1-win_x64-allmodules.zip",
         "jdk10-server-release-1804.tar.xz",
-        "java_tools_javac11_linux-v6.0.zip",
-        "java_tools_javac11_windows-v6.0.zip",
-        "java_tools_javac11_darwin-v6.0.zip",
+        "java_tools_javac11_linux-v6.1.zip",
+        "java_tools_javac11_windows-v6.1.zip",
+        "java_tools_javac11_darwin-v6.1.zip",
         "coverage_output_generator-v2.0.zip",
         "zulu11.2.3-jdk11.0.1-linux_x64.tar.gz",
         "zulu11.2.3-jdk11.0.1-macosx_x64.tar.gz",
@@ -528,9 +528,9 @@ distdir_tar(
         "zulu10.2+3-jdk10.0.1-macosx_x64-allmodules.tar.gz": "e669c9a897413d855b550b4e39d79614392e6fb96f494e8ef99a34297d9d85d3",
         "zulu10.2+3-jdk10.0.1-win_x64-allmodules.zip": "c39e7700a8d41794d60985df5a20352435196e78ecbc6a2b30df7be8637bffd5",
         "jdk10-server-release-1804.tar.xz": "b7098b7aaf6ee1ffd4a2d0371a0be26c5a5c87f6aebbe46fe9a92c90583a84be",
-        "java_tools_javac11_linux-v6.0.zip": "37acb8380b1dd6c31fd27a19bf3da821c9b02ee93c6163fce36f070a806516b5",
-        "java_tools_javac11_windows-v6.0.zip": "384e138ca58842ea563fb7efbe0cb9c5c381bd4de1f6a31f0256823325f81ccc",
-        "java_tools_javac11_darwin-v6.0.zip": "5a9f320c33424262e505151dd5c6903e36678a0f0bbdaae67bcf07f41d8c7cf3",
+        "java_tools_javac11_linux-v6.1.zip": "12f7940ed0bc4c2e82238951cdf19b4179c7dcc361d16fe40fe4266538fb4ac6",
+        "java_tools_javac11_windows-v6.1.zip": "e2deb2efff684de78787e0bdc7620f9672d13f04a12856d8e7f677369a8e286b",
+        "java_tools_javac11_darwin-v6.1.zip": "f0c488dac18f18ab1a0d18bbd65288c7a128e90a24d9c16f65bd8243f79483a0",
         "coverage_output_generator-v2.0.zip": "3a6951051272d51613ac4c77af6ce238a3db321bf06506fde1b8866eb18a89dd",
         "zulu11.2.3-jdk11.0.1-linux_x64.tar.gz": "232b1c3511f0d26e92582b7c3cc363be7ac633e371854ca2f2e9f2b50eb72a75",
         "zulu11.31.15-ca-jdk11.0.3-linux_aarch64.tar.gz": "3b0d91611b1bdc4d409afcf9eab4f0e7f4ae09f88fc01bd9f2b48954882ae69b",
@@ -558,9 +558,9 @@ distdir_tar(
         "zulu10.2+3-jdk10.0.1-macosx_x64-allmodules.tar.gz": ["https://mirror.bazel.build/openjdk/azul-zulu10.2+3-jdk10.0.1/zulu10.2+3-jdk10.0.1-macosx_x64-allmodules.tar.gz"],
         "zulu10.2+3-jdk10.0.1-win_x64-allmodules.zip": ["https://mirror.bazel.build/openjdk/azul-zulu10.2+3-jdk10.0.1/zulu10.2+3-jdk10.0.1-win_x64-allmodules.zip"],
         "jdk10-server-release-1804.tar.xz": ["https://mirror.bazel.build/openjdk.linaro.org/releases/jdk10-server-release-1804.tar.xz"],
-        "java_tools_javac11_linux-v6.0.zip": ["https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_linux-v6.0.zip"],
-        "java_tools_javac11_windows-v6.0.zip": ["https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_windows-v6.0.zip"],
-        "java_tools_javac11_darwin-v6.0.zip": ["https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_darwin-v6.0.zip"],
+        "java_tools_javac11_linux-v6.1.zip": ["https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.1/java_tools_javac11_linux-v6.1.zip"],
+        "java_tools_javac11_windows-v6.1.zip": ["https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.1/java_tools_javac11_windows-v6.1.zip"],
+        "java_tools_javac11_darwin-v6.1.zip": ["https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.1/java_tools_javac11_darwin-v6.1.zip"],
         "coverage_output_generator-v2.0.zip": ["https://mirror.bazel.build/bazel_coverage_output_generator/releases/coverage_output_generator-v2.0.zip"],
         "zulu11.2.3-jdk11.0.1-linux_x64.tar.gz": ["https://mirror.bazel.build/openjdk/azul-zulu11.2.3-jdk11.0.1/zulu11.2.3-jdk11.0.1-linux_x64.tar.gz"],
         "zulu11.2.3-jdk11.0.1-macosx_x64.tar.gz": ["https://mirror.bazel.build/openjdk/azul-zulu11.2.3-jdk11.0.1/zulu11.2.3-jdk11.0.1-macosx_x64.tar.gz"],
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE
index f96cff43385834..3919a596ae9ca2 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/java/jdk.WORKSPACE
@@ -230,30 +230,30 @@ maybe(
 maybe(
     http_archive,
     name = "remote_java_tools_linux",
-    sha256 = "37acb8380b1dd6c31fd27a19bf3da821c9b02ee93c6163fce36f070a806516b5",
+    sha256 = "12f7940ed0bc4c2e82238951cdf19b4179c7dcc361d16fe40fe4266538fb4ac6",
     urls = [
-        "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_linux-v6.0.zip",
-        "https://github.com/bazelbuild/java_tools/releases/download/javac11-v6.0/java_tools_javac11_linux-v6.0.zip",
+        "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.1/java_tools_javac11_linux-v6.1.zip",
+        "https://github.com/bazelbuild/java_tools/releases/download/javac11-v6.1/java_tools_javac11_linux-v6.1.zip",
     ],
 )
 
 maybe(
     http_archive,
     name = "remote_java_tools_windows",
-    sha256 = "384e138ca58842ea563fb7efbe0cb9c5c381bd4de1f6a31f0256823325f81ccc",
+    sha256 = "e2deb2efff684de78787e0bdc7620f9672d13f04a12856d8e7f677369a8e286b",
     urls = [
-        "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_windows-v6.0.zip",
-        "https://github.com/bazelbuild/java_tools/releases/download/javac11-v6.0/java_tools_javac11_windows-v6.0.zip",
+        "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.1/java_tools_javac11_windows-v6.1.zip",
+        "https://github.com/bazelbuild/java_tools/releases/download/javac11-v6.1/java_tools_javac11_windows-v6.1.zip",
     ],
 )
 
 maybe(
     http_archive,
     name = "remote_java_tools_darwin",
-    sha256 = "5a9f320c33424262e505151dd5c6903e36678a0f0bbdaae67bcf07f41d8c7cf3",
+    sha256 = "f0c488dac18f18ab1a0d18bbd65288c7a128e90a24d9c16f65bd8243f79483a0",
     urls = [
-        "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.0/java_tools_javac11_darwin-v6.0.zip",
-        "https://github.com/bazelbuild/java_tools/releases/download/javac11-v6.0/java_tools_javac11_darwin-v6.0.zip",
+        "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.1/java_tools_javac11_darwin-v6.1.zip",
+        "https://github.com/bazelbuild/java_tools/releases/download/javac11-v6.1/java_tools_javac11_darwin-v6.1.zip",
     ],
 )
 


Test patch:
diff --git a/src/test/shell/bazel/testdata/jdk_http_archives b/src/test/shell/bazel/testdata/jdk_http_archives
index 2181de92fd4e20..5e81598248e3ba 100644
--- a/src/test/shell/bazel/testdata/jdk_http_archives
+++ b/src/test/shell/bazel/testdata/jdk_http_archives
@@ -47,23 +47,23 @@ http_archive(
 ################### Remote java_tools with embedded javac 11 ###################
 http_archive(
     name = "remote_java_tools_javac11_test_linux",
-    sha256 = "10d6f00c72e42b6fda378ad506cc93b1dc92e1aec6e2a490151032244b8b8df5",
+    sha256 = "12f7940ed0bc4c2e82238951cdf19b4179c7dcc361d16fe40fe4266538fb4ac6",
     urls = [
-         "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v3.0/java_tools_javac11_linux-v3.0.zip",
+         "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.1/java_tools_javac11_linux-v6.1.zip",
     ],
 )
 http_archive(
     name = "remote_java_tools_javac11_test_windows",
-    sha256 = "b688155d81245b4d1ee52cac447aae5444b1c59dc77158fcbde05554a6bab48b",
+    sha256 = "e2deb2efff684de78787e0bdc7620f9672d13f04a12856d8e7f677369a8e286b",
     urls = [
-        "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v3.0/java_tools_javac11_windows-v3.0.zip",
+        "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.1/java_tools_javac11_windows-v6.1.zip",
     ],
 )
 http_archive(
     name = "remote_java_tools_javac11_test_darwin",
-    sha256 = "28989f78b1ce437c92dd27bb4943b2211ba4db916ccbb3aef83696a8f9b43724",
+    sha256 = "f0c488dac18f18ab1a0d18bbd65288c7a128e90a24d9c16f65bd8243f79483a0",
     urls = [
-         "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v3.0/java_tools_javac11_darwin-v3.0.zip",
+         "https://mirror.bazel.build/bazel_java_tools/releases/javac11/v6.1/java_tools_javac11_darwin-v6.1.zip",
     ],
 )