File tree Expand file tree Collapse file tree 3 files changed +5
-4
lines changed
presentation-compiler/test/dotty/tools/pc/utils Expand file tree Collapse file tree 3 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ import dotty.tools.dotc.util.SourceFile
22
22
class JdkIndex ():
23
23
val jdkSources = JdkSources ()
24
24
private val maybeJdkZipFs : Option [FileSystem ] =
25
- jdkSources.toOption.map(FileSystems .newFileSystem(_, Collections .emptyMap ))
25
+ jdkSources.toOption.map(FileSystems .newFileSystem(_, ( null : ClassLoader ) ))
26
26
27
27
def search (classfile : String , symbol : Symbol , query : String )(using
28
28
Context
@@ -35,7 +35,8 @@ class JdkIndex():
35
35
.split(" $" )
36
36
.headOption
37
37
.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
39
40
virtualFile = SourceFile .virtual(javafile, content)
40
41
untpdTree <- Try { JavaParser (virtualFile).parse() }.toOption
41
42
symbol <- extractSymbolInformation(untpdTree, symbol, query)
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ object JdkSources:
47
47
// In case java.home points to the JRE instead of the JDK,
48
48
// try to find jdk among its siblings
49
49
Option (javaHome.getParent).toList
50
- .flatMap(Files .list(_).toList .asScala)
50
+ .flatMap(Files .list(_).iterator .asScala)
51
51
.filter(isJdkCandidate)
52
52
.toArray[Path ]
53
53
.sortBy(_.filename)
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ trait PcAssertions:
71
71
throw error
72
72
73
73
private def unifyNewlines (str : String ): String =
74
- str.linesIterator.dropWhile(_.isBlank ).mkString(" \n " ).stripTrailing()
74
+ str.linesIterator.dropWhile(_.trim.isEmpty ).mkString(" \n " ).trim
75
75
76
76
private def addSnippet (description : StringDescription )(snippet : String ) =
77
77
description.appendText(System .lineSeparator)
You can’t perform that action at this time.
0 commit comments