File tree Expand file tree Collapse file tree 2 files changed +14
-10
lines changed
compiler/src/dotty/tools/dotc/interactive
language-server/src/dotty/tools/languageserver Expand file tree Collapse file tree 2 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -122,11 +122,17 @@ class InteractiveDriver(settings: List[String]) extends Driver {
122
122
123
123
// Like in `ZipArchiveFileLookup` we assume that zips are immutable
124
124
private val zipClassPathClasses : Seq [String ] = zipClassPaths.flatMap { zipCp =>
125
- new ZipFile (zipCp.zipFile)
126
- .stream
127
- .toArray((size : Int ) => new Array [ZipEntry ](size))
128
- .map((e : ZipEntry ) => e.getName)
129
- .flatMap((name : String ) => tastySuffixes.find(name.endsWith).map(name.replace(" /" , " ." ).stripSuffix))
125
+ val zipFile = new ZipFile (zipCp.zipFile)
126
+
127
+ try {
128
+ for {
129
+ entry <- zipFile.stream.iterator().asScala
130
+ name = entry.getName
131
+ tastySuffix <- tastySuffixes
132
+ if name.endsWith(tastySuffix)
133
+ } yield name.replace(" /" , " ." ).stripSuffix(tastySuffix)
134
+ }
135
+ finally zipFile.close()
130
136
}
131
137
132
138
// FIXME: classfiles in directories may change at any point, so we retraverse
Original file line number Diff line number Diff line change @@ -134,11 +134,9 @@ class DottyLanguageServer extends LanguageServer
134
134
// Do most of the initialization asynchronously so that we can return early
135
135
// from this method and thus let the client know our capabilities.
136
136
CompletableFuture .supplyAsync(() => drivers)
137
- .exceptionally {
138
- (ex : Throwable ) => {
139
- ex.printStackTrace
140
- sys.exit(1 )
141
- }
137
+ .exceptionally { (ex : Throwable ) =>
138
+ ex.printStackTrace
139
+ sys.exit(1 )
142
140
}
143
141
144
142
new InitializeResult (c)
You can’t perform that action at this time.
0 commit comments