Skip to content

Commit 6e08873

Browse files
committed
Fix toString of JarArchive
It returns the absolute path of the jar file instead of '/' [Cherry-picked 2fb98fd][modified]
1 parent 7e69d56 commit 6e08873

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import scala.jdk.CollectionConverters.*
1010
* This class implements an [[AbstractFile]] backed by a jar
1111
* that be can used as the compiler's output directory.
1212
*/
13-
class JarArchive private (root: Directory) extends PlainDirectory(root) {
14-
def close(): Unit = jpath.getFileSystem().close()
13+
class JarArchive private (val jarPath: Path, root: Directory) extends PlainDirectory(root) {
14+
def close(): Unit = this.synchronized(jpath.getFileSystem().close())
1515
def allFileNames(): Iterator[String] =
1616
java.nio.file.Files.walk(jpath).iterator().asScala.map(_.toString)
17+
18+
override def toString: String = jarPath.toString
1719
}
1820

1921
object JarArchive {
@@ -39,6 +41,6 @@ object JarArchive {
3941
}
4042
}
4143
val root = fs.getRootDirectories().iterator.next()
42-
new JarArchive(Directory(root))
44+
new JarArchive(path, Directory(root))
4345
}
4446
}

0 commit comments

Comments
 (0)