Skip to content

Commit f6fb5d5

Browse files
committed
Address review
1 parent 0e46820 commit f6fb5d5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compiler/src/dotty/tools/io/ZipArchive.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ final class FileZipArchive(jpath: JPath) extends ZipArchive(jpath) {
201201
private[this] var closeables: List[java.io.Closeable] = Nil
202202
override def close(): Unit = {
203203
closeables.foreach(_.close)
204+
closeables = Nil
204205
}
205206
}
206207

@@ -266,5 +267,6 @@ final class ManifestResources(val url: URL) extends ZipArchive(null) {
266267
private[this] var closeables: List[java.io.Closeable] = Nil
267268
override def close(): Unit = {
268269
closeables.foreach(_.close())
270+
closeables = Nil
269271
}
270272
}

compiler/test/dotty/tools/io/ZipArchiveTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ class ZipArchiveTest {
8383
finally {
8484
archive.close()
8585
// The following results in IOException on Windows (file in use by another process).
86-
// As jar is a temp file, it will be deleted automatically.
87-
// Files.delete(jar)
86+
// As jar created with Files.createTempFile, it will be deleted automatically.
87+
try Files.delete(jar) catch case _: IOException => ()
8888
}
8989
}
9090

0 commit comments

Comments
 (0)