Permalink
Browse files

Fix JavaLibraryBuildRequest for java 7

Bazel still supports java 7. This cl fixes a java 8-only construct introduced by commit 3c5e55f.
Liam, feel free to fix it to your liking afterwards.

--
PiperOrigin-RevId: 144206418
MOS_MIGRATED_REVID=144206418
  • Loading branch information...
1 parent 8e0f29c commit 2300f8a3e88d720f7eae90a80456142363850c5c @mhlopko mhlopko committed Jan 11, 2017
@@ -26,6 +26,7 @@
import java.io.File;
import java.io.IOError;
import java.io.IOException;
+import java.nio.file.DirectoryStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
@@ -303,7 +304,9 @@ public BlazeJavacArguments toBlazeJavacArguments(final String classPath) {
try {
Path path = Paths.get(file);
if (Files.isDirectory(path)) {
- Files.list(path).forEach(jars::add);
+ try (DirectoryStream<Path> directoryContents = Files.newDirectoryStream(path)) {
+ jars.addAll(directoryContents);
+ }
} else {
jars.add(path);
}

0 comments on commit 2300f8a

Please sign in to comment.