@@ -18,7 +18,7 @@ import java.nio.file.{FileSystems, Files}
18
18
import java .util
19
19
20
20
import scala .reflect .io .{AbstractFile , PlainFile , PlainNioFile }
21
- import scala .tools .nsc .util .{ClassPath , ClassRepresentation }
21
+ import scala .tools .nsc .util .{ClassPath , ClassRepresentation , EfficientClassPath , EfficientClassPathCallBack }
22
22
import FileUtils ._
23
23
import scala .collection .JavaConverters ._
24
24
import scala .reflect .internal .JDK9Reflectors
@@ -32,7 +32,7 @@ import scala.tools.nsc.classpath.PackageNameUtils.{packageContains, separatePkgA
32
32
* when we have a name of a package.
33
33
* It abstracts over the file representation to work with both JFile and AbstractFile.
34
34
*/
35
- trait DirectoryLookup [FileEntryType <: ClassRepresentation ] extends ClassPath {
35
+ trait DirectoryLookup [FileEntryType <: ClassRepresentation ] extends EfficientClassPath {
36
36
type F
37
37
38
38
val dir : F
@@ -75,6 +75,19 @@ trait DirectoryLookup[FileEntryType <: ClassRepresentation] extends ClassPath {
75
75
files.map(f => createFileEntry(toAbstractFile(f)))
76
76
}
77
77
78
+ override private [nsc] def list (inPackage : PackageName , callback : EfficientClassPathCallBack ): Unit = {
79
+ val dirForPackage = getDirectory(inPackage)
80
+ dirForPackage match {
81
+ case None =>
82
+ case Some (directory) =>
83
+ for (file <- listChildren(directory)) {
84
+ if (isPackage(file))
85
+ callback.packageEntry(PackageEntryImpl (inPackage.entryName(getName(file))))
86
+ else if (isMatchingFile(file))
87
+ callback.classesAndSources(createFileEntry(toAbstractFile(file)))
88
+ }
89
+ }
90
+ }
78
91
private [nsc] def list (inPackage : PackageName ): ClassPathEntries = {
79
92
val dirForPackage = getDirectory(inPackage)
80
93
val files : Array [F ] = dirForPackage match {
0 commit comments