Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/io/JarArchive.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import scala.jdk.CollectionConverters.*
class JarArchive private (underlying: Path, root: Directory) extends PlainDirectory(root) {
def close(): Unit = this.synchronized(jpath.getFileSystem().close())

override val path: String = underlying.path
override lazy val path: String = underlying.path
override def ext: FileExtension = underlying.ext

override def exists: Boolean = jpath.getFileSystem().isOpen() && super.exists
Expand Down
9 changes: 4 additions & 5 deletions compiler/src/dotty/tools/io/PlainFile.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,18 @@ class PlainFile(givenPath: Path) extends AbstractFile {

override def name: String = givenPath.name

// Interned for fast hashcode and equals
override val path: String = givenPath.normalize.path.intern
override lazy val path: String = givenPath.normalize.path

override def container: Option[AbstractFile] = Some(new PlainFile(givenPath.parent))
override def input: InputStream = givenPath.toFile.inputStream()
override def output: OutputStream = givenPath.toFile.outputStream()
override def toURL: Option[URL] = Some(jpath.toUri.toURL)

override def hashCode(): Int = System.identityHashCode(path)
override def equals(that: Any): Boolean = that match {
override def hashCode(): Int = path.hashCode
override def equals(that: Any): Boolean = (this `eq` that.asInstanceOf[Object]) || (that match {
case x: PlainFile => path `eq` x.path
case _ => false
}
})

/** Is this abstract file a directory? */
override val isDirectory: Boolean = givenPath.isDirectory // cached for performance on Windows
Expand Down
Loading