From a45f57b22dd52077fb45baff5a2ba832c22a04df Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Thu, 29 Mar 2018 10:34:01 +0200 Subject: [PATCH 1/2] Fix #4207: Read whole zipfile before closing --- .../src/dotty/tools/dotc/interactive/InteractiveDriver.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala b/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala index 0215dc06b98e..f8407c988d4f 100644 --- a/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala +++ b/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala @@ -132,7 +132,7 @@ class InteractiveDriver(val settings: List[String]) extends Driver { try { for { - entry <- zipFile.stream.iterator().asScala + entry <- zipFile.stream.toArray((size: Int) => new Array[ZipEntry](size)) name = entry.getName tastySuffix <- tastySuffixes if name.endsWith(tastySuffix) From 4316c9fd3d0983a870e50709209b246b2a35e9e2 Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Thu, 29 Mar 2018 10:51:27 +0200 Subject: [PATCH 2/2] Address review comments --- .../src/dotty/tools/dotc/interactive/InteractiveDriver.scala | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala b/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala index f8407c988d4f..fa7ca5437cd2 100644 --- a/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala +++ b/compiler/src/dotty/tools/dotc/interactive/InteractiveDriver.scala @@ -134,8 +134,7 @@ class InteractiveDriver(val settings: List[String]) extends Driver { for { entry <- zipFile.stream.toArray((size: Int) => new Array[ZipEntry](size)) name = entry.getName - tastySuffix <- tastySuffixes - if name.endsWith(tastySuffix) + tastySuffix <- tastySuffixes.find(name.endsWith) } yield name.replace("/", ".").stripSuffix(tastySuffix) } finally zipFile.close()