@@ -77,8 +77,8 @@ class InteractiveDriver(val settings: List[String]) extends Driver {
77
77
}
78
78
79
79
// Like in `ZipArchiveFileLookup` we assume that zips are immutable
80
- private val zipClassPathClasses : Seq [String ] = {
81
- val names = new mutable.ListBuffer [String ]
80
+ private val zipClassPathClasses : Seq [TypeName ] = {
81
+ val names = new mutable.ListBuffer [TypeName ]
82
82
zipClassPaths.foreach { zipCp =>
83
83
val zipFile = new ZipFile (zipCp.zipFile)
84
84
classesFromZip(zipFile, names)
@@ -105,7 +105,7 @@ class InteractiveDriver(val settings: List[String]) extends Driver {
105
105
def sourceTreesContaining (id : String )(implicit ctx : Context ): List [SourceTree ] = {
106
106
val fromBuffers = openedTrees.values.flatten.toList
107
107
val fromCompilationOutput = {
108
- val classNames = new mutable.ListBuffer [String ]
108
+ val classNames = new mutable.ListBuffer [TypeName ]
109
109
val output = ctx.settings.outputDir.value
110
110
if (output.isDirectory) {
111
111
classesFromDir(output.jpath, classNames)
@@ -114,8 +114,7 @@ class InteractiveDriver(val settings: List[String]) extends Driver {
114
114
classesFromZip(zipFile, classNames)
115
115
}
116
116
classNames.flatMap { cls =>
117
- val className = cls.toTypeName
118
- treesFromClassName(className, id = " " )
117
+ treesFromClassName(cls, id)
119
118
}
120
119
}
121
120
(fromBuffers ++ fromCompilationOutput).distinct
@@ -138,8 +137,7 @@ class InteractiveDriver(val settings: List[String]) extends Driver {
138
137
def allTreesContaining (id : String )(implicit ctx : Context ): List [SourceTree ] = {
139
138
val fromSource = openedTrees.values.flatten.toList
140
139
val fromClassPath = (dirClassPathClasses ++ zipClassPathClasses).flatMap { cls =>
141
- val className = cls.toTypeName
142
- treesFromClassName(className, id)
140
+ treesFromClassName(cls, id)
143
141
}
144
142
(fromSource ++ fromClassPath).distinct
145
143
}
@@ -205,8 +203,8 @@ class InteractiveDriver(val settings: List[String]) extends Driver {
205
203
// FIXME: classfiles in directories may change at any point, so we retraverse
206
204
// the directories each time, if we knew when classfiles changed (sbt
207
205
// server-mode might help here), we could do cache invalidation instead.
208
- private def dirClassPathClasses : Seq [String ] = {
209
- val names = new mutable.ListBuffer [String ]
206
+ private def dirClassPathClasses : Seq [TypeName ] = {
207
+ val names = new mutable.ListBuffer [TypeName ]
210
208
dirClassPaths.foreach { dirCp =>
211
209
val root = dirCp.dir.toPath
212
210
classesFromDir(root, names)
@@ -215,19 +213,19 @@ class InteractiveDriver(val settings: List[String]) extends Driver {
215
213
}
216
214
217
215
/** Adds the names of the classes that are defined in `zipFile` to `buffer`. */
218
- private def classesFromZip (zipFile : ZipFile , buffer : mutable.ListBuffer [String ]): Unit = {
216
+ private def classesFromZip (zipFile : ZipFile , buffer : mutable.ListBuffer [TypeName ]): Unit = {
219
217
try {
220
218
for {
221
219
entry <- zipFile.stream.toArray((size : Int ) => new Array [ZipEntry ](size))
222
220
name = entry.getName
223
221
tastySuffix <- tastySuffixes.find(name.endsWith)
224
- } buffer += name.replace(" /" , " ." ).stripSuffix(tastySuffix)
222
+ } buffer += name.replace(" /" , " ." ).stripSuffix(tastySuffix).toTypeName
225
223
}
226
224
finally zipFile.close()
227
225
}
228
226
229
227
/** Adds the names of the classes that are defined in `dir` to `buffer`. */
230
- private def classesFromDir (dir : Path , buffer : mutable.ListBuffer [String ]): Unit = {
228
+ private def classesFromDir (dir : Path , buffer : mutable.ListBuffer [TypeName ]): Unit = {
231
229
try
232
230
Files .walkFileTree(dir, new SimpleFileVisitor [Path ] {
233
231
override def visitFile (path : Path , attrs : BasicFileAttributes ) = {
@@ -237,7 +235,7 @@ class InteractiveDriver(val settings: List[String]) extends Driver {
237
235
tastySuffix <- tastySuffixes
238
236
if name.endsWith(tastySuffix)
239
237
} {
240
- buffer += dir.relativize(path).toString.replace(" /" , " ." ).stripSuffix(tastySuffix)
238
+ buffer += dir.relativize(path).toString.replace(" /" , " ." ).stripSuffix(tastySuffix).toTypeName
241
239
}
242
240
}
243
241
FileVisitResult .CONTINUE
0 commit comments