Skip to content

Commit 2704324

Browse files
Merge pull request #15240 from dotty-staging/coverage-paths-fix
Fix relativizing paths in coverage serializer
2 parents d75c32d + 9cbbdf7 commit 2704324

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/coverage/Serializer.scala

+3-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ object Serializer:
3131
def serialize(coverage: Coverage, writer: Writer, sourceRoot: Path): Unit =
3232

3333
def getRelativePath(filePath: Path): String =
34-
val relPath = sourceRoot.relativize(filePath)
34+
// We need to normalize the path here because the relativizing paths containing '.' or '..' differs between Java versions
35+
// https://bugs.openjdk.java.net/browse/JDK-8066943
36+
val relPath = sourceRoot.normalize.relativize(filePath)
3537
relPath.toString
3638

3739
def writeHeader(writer: Writer): Unit =

0 commit comments

Comments
 (0)