Skip to content

Commit 3b24b6e

Browse files
committed
use java8 compatible api
1 parent e7abd09 commit 3b24b6e

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

presentation-compiler/test/dotty/tools/pc/utils/JdkIndex.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import dotty.tools.dotc.util.SourceFile
2222
class JdkIndex():
2323
val jdkSources = JdkSources()
2424
private val maybeJdkZipFs: Option[FileSystem] =
25-
jdkSources.toOption.map(FileSystems.newFileSystem(_, Collections.emptyMap))
25+
jdkSources.toOption.map(FileSystems.newFileSystem(_, (null: ClassLoader)))
2626

2727
def search(classfile: String, symbol: Symbol, query: String)(using
2828
Context
@@ -35,7 +35,8 @@ class JdkIndex():
3535
.split("$")
3636
.headOption
3737
.map(_.stripSuffix("class") ++ "java")
38-
content <- Try { Files.readString(fsroot.resolve(javafile)) }.toOption
38+
if Files.exists(fsroot.resolve(javafile))
39+
content <- Try { String(Files.readAllBytes(fsroot.resolve(javafile))) }.toOption
3940
virtualFile = SourceFile.virtual(javafile, content)
4041
untpdTree <- Try { JavaParser(virtualFile).parse() }.toOption
4142
symbol <- extractSymbolInformation(untpdTree, symbol, query)

presentation-compiler/test/dotty/tools/pc/utils/JdkSources.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ object JdkSources:
4747
// In case java.home points to the JRE instead of the JDK,
4848
// try to find jdk among its siblings
4949
Option(javaHome.getParent).toList
50-
.flatMap(Files.list(_).toList.asScala)
50+
.flatMap(Files.list(_).iterator.asScala)
5151
.filter(isJdkCandidate)
5252
.toArray[Path]
5353
.sortBy(_.filename)

presentation-compiler/test/dotty/tools/pc/utils/PcAssertions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ trait PcAssertions:
7171
throw error
7272

7373
private def unifyNewlines(str: String): String =
74-
str.linesIterator.dropWhile(_.isBlank).mkString("\n").stripTrailing()
74+
str.linesIterator.dropWhile(_.trim.isEmpty).mkString("\n").trim
7575

7676
private def addSnippet(description: StringDescription)(snippet: String) =
7777
description.appendText(System.lineSeparator)

0 commit comments

Comments
 (0)