Tolerate empty bootclasspaths in javac-turbine

PiperOrigin-RevId: 191809494
diff --git a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java b/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java
index 20b8689..d422cd3 100644
--- a/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java
+++ b/src/java_tools/buildjar/java/com/google/devtools/build/buildjar/javac/BlazeJavacMain.java
@@ -210,7 +210,7 @@
       }
       fileManager.setLocationFromPaths(StandardLocation.SOURCE_PATH, sourcePath);
 
-      // TODO(cushon): require an explicit bootclasspath
+      // The bootclasspath may legitimately be empty if --release is being used.
       Collection<Path> bootClassPath = arguments.bootClassPath();
       if (!bootClassPath.isEmpty()) {
         fileManager.setLocationFromPaths(StandardLocation.PLATFORM_CLASS_PATH, bootClassPath);
diff --git a/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/JavacTurbineCompiler.java b/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/JavacTurbineCompiler.java
index f88b1a7..3ee4d20 100644
--- a/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/JavacTurbineCompiler.java
+++ b/src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac/JavacTurbineCompiler.java
@@ -40,6 +40,7 @@
 import java.nio.file.Path;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedHashMap;
 import java.util.Locale;
@@ -85,7 +86,11 @@
         fm.setContext(context);
         fm.setLocationFromPaths(StandardLocation.SOURCE_PATH, Collections.<Path>emptyList());
         fm.setLocationFromPaths(StandardLocation.CLASS_PATH, request.classPath());
-        fm.setLocationFromPaths(StandardLocation.PLATFORM_CLASS_PATH, request.bootClassPath());
+        // The bootclasspath may legitimately be empty if --release is being used.
+        Collection<Path> bootClassPath = request.bootClassPath();
+        if (!bootClassPath.isEmpty()) {
+          fm.setLocationFromPaths(StandardLocation.PLATFORM_CLASS_PATH, bootClassPath);
+        }
         fm.setLocationFromPaths(
             StandardLocation.ANNOTATION_PROCESSOR_PATH, request.processorClassPath());
         fm.setLocationFromPaths(StandardLocation.CLASS_OUTPUT, ImmutableList.of(classes));