@@ -69,6 +69,10 @@ class InteractiveDriver(settings: List[String]) extends Driver {
69
69
}
70
70
}
71
71
72
+ // Presence of a file with one of these suffixes indicates that the
73
+ // corresponding class has been pickled with TASTY.
74
+ private val tastySuffixes = List (" .hasTasty" , " .tasty" )
75
+
72
76
private def classNames (cp : ClassPath , packageName : String ): List [String ] = {
73
77
def className (classSegments : List [String ]) =
74
78
classSegments.mkString(" ." ).stripSuffix(" .class" )
@@ -85,9 +89,6 @@ class InteractiveDriver(settings: List[String]) extends Driver {
85
89
binFile.name.stripSuffix(" .class" )
86
90
else
87
91
null
88
- // Presence of a file with one of these suffixes indicates that the
89
- // corresponding class has been pickled with TASTY.
90
- val tastySuffixes = List (" .hasTasty" , " .tasty" )
91
92
prefix != null && {
92
93
binFile match {
93
94
case pf : PlainFile =>
@@ -123,8 +124,12 @@ class InteractiveDriver(settings: List[String]) extends Driver {
123
124
.stream
124
125
.toArray(new IntFunction [Array [ZipEntry ]] { def apply (size : Int ) = new Array (size) })
125
126
.toSeq
126
- entries.filter(_.getName.endsWith(" .tasty" ))
127
- .map(_.getName.replace(" /" , " ." ).stripSuffix(" .tasty" ))
127
+ for {
128
+ entry <- entries
129
+ name = entry.getName
130
+ tastySuffix <- tastySuffixes
131
+ if name.endsWith(tastySuffix)
132
+ } yield name.replace(" /" , " ." ).stripSuffix(tastySuffix)
128
133
}
129
134
130
135
// FIXME: classfiles in directories may change at any point, so we retraverse
@@ -136,8 +141,14 @@ class InteractiveDriver(settings: List[String]) extends Driver {
136
141
val root = dirCp.dir.toPath
137
142
Files .walkFileTree(root, new SimpleFileVisitor [Path ] {
138
143
override def visitFile (path : Path , attrs : BasicFileAttributes ) = {
139
- if (! attrs.isDirectory && path.getFileName.toString.endsWith(" .tasty" )) {
140
- names += root.relativize(path).toString.replace(" /" , " ." ).stripSuffix(" .tasty" )
144
+ if (! attrs.isDirectory) {
145
+ val name = path.getFileName.toString
146
+ for {
147
+ tastySuffix <- tastySuffixes
148
+ if name.endsWith(tastySuffix)
149
+ } {
150
+ names += root.relativize(path).toString.replace(" /" , " ." ).stripSuffix(tastySuffix)
151
+ }
141
152
}
142
153
FileVisitResult .CONTINUE
143
154
}
0 commit comments