@@ -99,21 +99,23 @@ trait JFileDirectoryLookup[FileEntryType <: ClassRepresentation] extends Directo
99
99
case None => dir.listFiles()
100
100
}
101
101
102
- // Sort by file name for stable order of directory .class entries in package scope.
103
- // This gives stable results ordering of base type sequences for unrelated classes
104
- // with the same base type depth.
105
- //
106
- // Notably, this will stably infer`Product with Serializable`
107
- // as the type of `case class C(); case class D(); List(C(), D()).head`, rather than the opposite order.
108
- // On Mac, the HFS performs this sorting transparently, but on Linux the order is unspecified.
109
- //
110
- // Note this behaviour can be enabled in javac with `javac -XDsortfiles`, but that's only
111
- // intended to improve determinism of the compiler for compiler hackers.
112
- java.util.Arrays .sort(listing,
113
- new java.util.Comparator [File ] {
114
- def compare (o1 : File , o2 : File ) = o1.getName.compareTo(o2.getName)
115
- })
116
- listing
102
+ if (listing != null ) {
103
+ // Sort by file name for stable order of directory .class entries in package scope.
104
+ // This gives stable results ordering of base type sequences for unrelated classes
105
+ // with the same base type depth.
106
+ //
107
+ // Notably, this will stably infer`Product with Serializable`
108
+ // as the type of `case class C(); case class D(); List(C(), D()).head`, rather than the opposite order.
109
+ // On Mac, the HFS performs this sorting transparently, but on Linux the order is unspecified.
110
+ //
111
+ // Note this behaviour can be enabled in javac with `javac -XDsortfiles`, but that's only
112
+ // intended to improve determinism of the compiler for compiler hackers.
113
+ java.util.Arrays .sort(listing,
114
+ new java.util.Comparator [File ] {
115
+ def compare (o1 : File , o2 : File ) = o1.getName.compareTo(o2.getName)
116
+ })
117
+ listing
118
+ } else Array ()
117
119
}
118
120
protected def getName (f : File ): String = f.getName
119
121
protected def toAbstractFile (f : File ): AbstractFile = new PlainFile (new scala.reflect.io.File (f))
0 commit comments