From 4d354a7c2383cb2ba2733a3c3ec2b73e8f9c1e76 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Wed, 26 Jul 2017 10:04:14 +0200 Subject: [PATCH] Alternative fix for #2506 that does not force dirs As stated in #2506 `lazy` was droped to make it volatile. It turns out that the dirs is not always used and epensive to compute. In `implicit_cache.scala` only need dirs 1 out of 30 times. --- compiler/src/dotty/tools/io/ZipArchive.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/src/dotty/tools/io/ZipArchive.scala b/compiler/src/dotty/tools/io/ZipArchive.scala index fe18ecf13cfa..b0aad16bb797 100644 --- a/compiler/src/dotty/tools/io/ZipArchive.scala +++ b/compiler/src/dotty/tools/io/ZipArchive.scala @@ -149,7 +149,7 @@ final class FileZipArchive(file: JFile) extends ZipArchive(file) { override def sizeOption: Option[Int] = Some(zipEntry.getSize.toInt) } - val (root, allDirs) = { + @volatile lazy val (root, allDirs) = { val root = new DirEntry("/") val dirs = mutable.HashMap[String, DirEntry]("/" -> root) val zipFile = openZipFile()