incompatible_use_remote_host_java_toolchain: use remote Java tools instead of the embedded deploy jars
The option `--incompatible_use_remote_host_java_toolchain` will download the remote Java tools (archive of deploy jars) for the host configuration instead of using the corresponding embedded deploy jars. Enabling this flag only affects users of the Java rules.

# Migration Notes

There are no actions required from the users. No migration is needed.

src/main/java/com/google/devtools/build/lib/rules/java/JavaOptions.java
src/main/java/com/google/devtools/build/lib/rules/java/JavaOptions.java
src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java src/test/java/com/google/devtools/build/lib/rules/java/JavaSkylarkApiTest.java
diff --git a/src/main/java/com/google/devtools/build/lib/rules/java/JavaOptions.java b/src/main/java/com/google/devtools/build/lib/rules/java/JavaOptions.java
index d4a72fdff59878..70e0c0679b2257 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/java/JavaOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/java/JavaOptions.java
@@ -586,7 +586,7 @@ public ImportDepsCheckingLevelConverter() {
 
   @Option(
       name = "incompatible_use_remote_java_toolchain",
-      defaultValue = "false",
+      defaultValue = "true",
       documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
       effectTags = {OptionEffectTag.UNKNOWN},
       metadataTags = {
@@ -600,7 +600,7 @@ public ImportDepsCheckingLevelConverter() {
 
   @Option(
       name = "incompatible_use_remote_host_java_toolchain",
-      defaultValue = "false",
+      defaultValue = "true",
       documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
       effectTags = {OptionEffectTag.UNKNOWN},
       metadataTags = {

diff --git a/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java b/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java
index e58cd0e121b1f8..9f0557f2c4b487 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/mock/BazelAnalysisMock.java
@@ -108,6 +108,19 @@ public void setupMockClient(MockToolsConfig config, List<String> workspaceConten
         "  genclass = ['GenClass_deploy.jar'],",
         "  ijar = ['ijar'],",
         ")",
+        "java_toolchain(",
+        "  name = 'remote_toolchain',",
+        "  source_version = '8',",
+        "  target_version = '8',",
+        "  bootclasspath = [':bootclasspath'],",
+        "  extclasspath = [':extclasspath'],",
+        "  javac = [':langtools'],",
+        "  javabuilder = ['JavaBuilder_deploy.jar'],",
+        "  header_compiler = ['turbine_deploy.jar'],",
+        "  singlejar = ['SingleJar_deploy.jar'],",
+        "  genclass = ['GenClass_deploy.jar'],",
+        "  ijar = ['ijar'],",
+        ")",
         "java_runtime(name = 'jdk', srcs = [])",
         "java_runtime(name = 'host_jdk', srcs = [])",
         "java_runtime(name = 'remote_jdk', srcs = [])",
diff --git a/src/test/java/com/google/devtools/build/lib/rules/java/JavaSkylarkApiTest.java b/src/test/java/com/google/devtools/build/lib/rules/java/JavaSkylarkApiTest.java
index f86d67aa924f05..185c58acc6143b 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/java/JavaSkylarkApiTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/java/JavaSkylarkApiTest.java
@@ -1899,7 +1899,10 @@ public void javaToolchainFlag_default() throws Exception {
             configuredTarget.get(
                 new SkylarkKey(Label.parseAbsolute("//foo:rule.bzl", ImmutableMap.of()), "result"));
     Label javaToolchainLabel = ((Label) info.getValue("java_toolchain_label"));
-    assertThat(javaToolchainLabel.toString()).endsWith("jdk:toolchain");
+    assertThat(
+            javaToolchainLabel.toString().endsWith("jdk:remote_toolchain")
+                || javaToolchainLabel.toString().endsWith("jdk:toolchain"))
+        .isTrue();
   }
 
   @Test
