desguar tests: Use toolchains rather than the legacy jdk targets.

Closes #14147.

PiperOrigin-RevId: 405342669
diff --git a/src/test/java/com/google/devtools/build/android/desugar/BUILD b/src/test/java/com/google/devtools/build/android/desugar/BUILD
index 2c15347..28b10a3 100644
--- a/src/test/java/com/google/devtools/build/android/desugar/BUILD
+++ b/src/test/java/com/google/devtools/build/android/desugar/BUILD
@@ -558,7 +558,7 @@
     data = [
         "testdata_desugared.jar",
         "testdata_desugared_jar_toc_golden.txt",  # Golden file
-        "@bazel_tools//tools/jdk",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
@@ -577,7 +577,7 @@
     data = [
         "testdata_desugared_jar_toc_golden.txt",
         "testdata_desugared_twice.jar",
-        "@bazel_tools//tools/jdk",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
@@ -595,7 +595,7 @@
     data = [
         "testdata_desugared_java8.jar",
         "testdata_desugared_java8_jar_toc_golden.txt",  # Golden file
-        "@bazel_tools//tools/jdk",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
@@ -615,7 +615,7 @@
     data = [
         "testdata_desugared_core_library.jar",
         "testdata_desugared_core_library_jar_toc_golden.txt",  # Golden file
-        "@bazel_tools//tools/jdk",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
@@ -633,7 +633,7 @@
     data = [
         "testdata_desugared_for_try_with_resources.jar",
         "testdata_desugared_for_try_with_resources_jar_toc_golden.txt",  # Golden file
-        "@bazel_tools//tools/jdk",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
@@ -651,7 +651,7 @@
     data = [
         "testdata_desugared_for_try_with_resources_jar_toc_golden.txt",  # Golden file
         "testdata_desugared_for_try_with_resources_twice.jar",
-        "@bazel_tools//tools/jdk",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
@@ -670,7 +670,7 @@
     data = [
         "testdata_desugared_for_NO_desugaring_try_with_resources.jar",
         "testdata_desugared_for_disabling_twr_with_large_minsdkversion_jar_toc_golden.txt",  # Golden file
-        "@bazel_tools//tools/jdk",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
@@ -789,7 +789,7 @@
     data = [
         "testdata_desugared_without_lambda_desugared.jar",
         "testdata_desugared_without_lambda_desugared_jar_toc_golden.txt",  # Golden file
-        "@bazel_tools//tools/jdk",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
@@ -1628,7 +1628,7 @@
 """,
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_host_java_runtime"],
-    tools = ["@bazel_tools//tools/jdk"],
+    tools = ["@bazel_tools//tools/jdk:current_java_runtime"],
 )
 
 sh_test(
@@ -1656,7 +1656,7 @@
 """,
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
-    tools = ["@bazel_tools//tools/jdk"],
+    tools = ["@bazel_tools//tools/jdk:current_java_runtime"],
 )
 
 sh_test(
@@ -1683,7 +1683,7 @@
 """,
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
-    tools = ["@bazel_tools//tools/jdk"],
+    tools = ["@bazel_tools//tools/jdk:current_java_runtime"],
 )
 
 sh_test(
@@ -1712,7 +1712,7 @@
 """,
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
-    tools = ["@bazel_tools//tools/jdk"],
+    tools = ["@bazel_tools//tools/jdk:current_java_runtime"],
 )
 
 sh_test(
@@ -1741,7 +1741,7 @@
 """,
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
-    tools = ["@bazel_tools//tools/jdk"],
+    tools = ["@bazel_tools//tools/jdk:current_java_runtime"],
 )
 
 sh_test(
@@ -1770,7 +1770,7 @@
 """,
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
-    tools = ["@bazel_tools//tools/jdk"],
+    tools = ["@bazel_tools//tools/jdk:current_java_runtime"],
 )
 
 sh_test(
@@ -1859,7 +1859,7 @@
 grep lambda $(location baseclass_disassembled.txt) > $(location baseclass_lambda_signature.txt)""",
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
-    tools = ["@bazel_tools//tools/jdk"],
+    tools = ["@bazel_tools//tools/jdk:current_java_runtime"],
 )
 
 genrule(
@@ -1875,7 +1875,7 @@
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
     tools = [
-        "@bazel_tools//tools/jdk",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
 )
 
@@ -1888,7 +1888,7 @@
     srcs = ["desugar_deps_consistency_test.sh"],
     args = [
         "$(location %s)" % singlejar,
-        "$(location @bazel_tools//tools/jdk:jar)",
+        "$(JAVABASE)/bin/jar",
         "$(location :testdata_desugared_default_methods.jar)",
         "$(location :separate_java8_desugared_default_methods.jar)",
         "$(location :guava_at_head_desugared.jar)",
@@ -1898,9 +1898,10 @@
         ":separate_java8_desugared_default_methods.jar",
         ":testdata_desugared_default_methods.jar",
         singlejar,
-        "@bazel_tools//tools/jdk:jar",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
     tags = ["no_windows"],
+    toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
 ) for label, singlejar in _SINGLEJAR_IMPLS.items()]
 
 # Tests that deps checking fails due to missing default method: libseparate_java8.jar defines
@@ -1910,7 +1911,7 @@
     srcs = ["desugar_deps_consistency_test.sh"],
     args = [
         "$(location %s)" % singlejar,
-        "$(location @bazel_tools//tools/jdk:jar)",
+        "$(JAVABASE)/bin/jar",
         "$(location :testdata_desugared_default_methods.jar)",
         "$(location :libseparate_java8.jar)",
         "$(location :guava_at_head_desugared.jar)",
@@ -1920,9 +1921,10 @@
         ":libseparate_java8.jar",
         ":testdata_desugared_default_methods.jar",
         singlejar,
-        "@bazel_tools//tools/jdk:jar",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
     tags = ["no_windows"],
+    toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
 ) for label, singlejar in _SINGLEJAR_IMPLS.items()]
 
 # Regression test for b/68049457 with deps checking failing due to missing static method:
@@ -1933,15 +1935,16 @@
     srcs = ["desugar_deps_consistency_test.sh"],
     args = [
         "$(location %s)" % singlejar,
-        "$(location @bazel_tools//tools/jdk:jar)",
+        "$(JAVABASE)/bin/jar",
         "$(location :b68049457_caller_desugared.jar)",
     ],
     data = [
         ":b68049457_caller_desugared.jar",
         singlejar,
-        "@bazel_tools//tools/jdk:jar",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
     tags = ["no_windows"],
+    toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
 ) for label, singlejar in _SINGLEJAR_IMPLS.items()]
 
 [sh_test(
@@ -1949,7 +1952,7 @@
     srcs = ["desugar_deps_consistency_test.sh"],
     args = [
         "$(location %s)" % singlejar,
-        "$(location @bazel_tools//tools/jdk:jar)",
+        "$(JAVABASE)/bin/jar",
         "$(location :testdata_desugared_with_missing_dep.jar)",
         "$(location :separate_java8_desugared_default_methods.jar)",
         "$(location :guava_at_head_desugared.jar)",
@@ -1959,9 +1962,10 @@
         ":separate_java8_desugared_default_methods.jar",
         ":testdata_desugared_with_missing_dep.jar",
         singlejar,
-        "@bazel_tools//tools/jdk:jar",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
     tags = ["no_windows"],
+    toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
 ) for label, singlejar in _SINGLEJAR_IMPLS.items()]
 
 # Tests that any Jar entry starting with j$/ causes singlejar to fail when run
@@ -1972,15 +1976,16 @@
     srcs = ["desugar_deps_consistency_test.sh"],
     args = [
         "$(location %s)" % singlejar,
-        "$(location @bazel_tools//tools/jdk:jar)",
+        "$(JAVABASE)/bin/jar",
         "$(location :mock_bad_entry_jar)",
     ],
     data = [
         ":mock_bad_entry_jar",
         singlejar,
-        "@bazel_tools//tools/jdk:jar",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
     tags = ["no_windows"],
+    toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
 ) for label, singlejar in _SINGLEJAR_IMPLS.items()]
 
 genrule(
@@ -2066,7 +2071,7 @@
     tags = ["no_windows"],
     toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
     tools = [
-        "@bazel_tools//tools/jdk",
+        "@bazel_tools//tools/jdk:current_java_runtime",
     ],
 )