Version 0.1.6

This merge fixes file descriptor
that was not closed. There are no
functional changes.

Merge "Close Files.list stream"
CL: https://r8-review.googlesource.com/c/r8/+/5442

Change-Id: I015dbeeb8d947cf24b31b9c8d3022f79b0344db3
diff --git a/src/main/java/com/android/tools/r8/D8.java b/src/main/java/com/android/tools/r8/D8.java
index 33e383c..790bfc8 100644
--- a/src/main/java/com/android/tools/r8/D8.java
+++ b/src/main/java/com/android/tools/r8/D8.java
@@ -55,7 +55,7 @@
  */
 public final class D8 {
 
-  private static final String VERSION = "v0.1.5";
+  private static final String VERSION = "v0.1.6";
   private static final int STATUS_ERROR = 1;
 
   private D8() {}
diff --git a/src/main/java/com/android/tools/r8/R8.java b/src/main/java/com/android/tools/r8/R8.java
index 45b43db..61567a5 100644
--- a/src/main/java/com/android/tools/r8/R8.java
+++ b/src/main/java/com/android/tools/r8/R8.java
@@ -71,7 +71,7 @@
 
 public class R8 {
 
-  private static final String VERSION = "v0.1.5";
+  private static final String VERSION = "v0.1.6";
   private final Timing timing = new Timing("R8");
   private final InternalOptions options;
 
diff --git a/src/main/java/com/android/tools/r8/utils/AndroidApp.java b/src/main/java/com/android/tools/r8/utils/AndroidApp.java
index 97a3679..96eda45 100644
--- a/src/main/java/com/android/tools/r8/utils/AndroidApp.java
+++ b/src/main/java/com/android/tools/r8/utils/AndroidApp.java
@@ -32,6 +32,7 @@
 import java.util.List;
 import java.util.Set;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
@@ -302,9 +303,11 @@
    */
   public void writeToDirectory(Path directory, OutputMode outputMode) throws IOException {
     if (outputMode == OutputMode.Indexed) {
-      for (Path path : Files.list(directory).collect(Collectors.toList())) {
-        if (isClassesDexFile(path)) {
-          Files.delete(path);
+      try (Stream<Path> filesInDir = Files.list(directory)) {
+        for (Path path : filesInDir.collect(Collectors.toList())) {
+          if (isClassesDexFile(path)) {
+            Files.delete(path);
+          }
         }
       }
     }