From 76542f83e95e7bd5d23e4d1cc7af6745521e9ab9 Mon Sep 17 00:00:00 2001 From: OlegYch Date: Mon, 15 Apr 2024 17:29:38 +0300 Subject: [PATCH] Regression: fix compilation performance on Windows by caching isDirectory calls Fixes #19924 backport to start-3.4.1 --- compiler/src/dotty/tools/io/PlainFile.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/io/PlainFile.scala b/compiler/src/dotty/tools/io/PlainFile.scala index acef191d3072..933157e997ac 100644 --- a/compiler/src/dotty/tools/io/PlainFile.scala +++ b/compiler/src/dotty/tools/io/PlainFile.scala @@ -13,7 +13,7 @@ import java.nio.file.{InvalidPathException, Paths} /** ''Note: This library is considered experimental and should not be used unless you know what you are doing.'' */ class PlainDirectory(givenPath: Directory) extends PlainFile(givenPath) { - override def isDirectory: Boolean = true + override val isDirectory: Boolean = true override def iterator(): Iterator[PlainFile] = givenPath.list.filter(_.exists).map(new PlainFile(_)) override def delete(): Unit = givenPath.deleteRecursively() } @@ -78,7 +78,7 @@ class PlainFile(val givenPath: Path) extends AbstractFile { } /** Is this abstract file a directory? */ - def isDirectory: Boolean = givenPath.isDirectory + val isDirectory: Boolean = givenPath.isDirectory /** Returns the time that this abstract file was last modified. */ def lastModified: Long = givenPath.lastModified.toMillis