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 @@ -128,11 +128,17 @@ class InteractiveDriver(val settings: List[String]) extends Driver {
128128
129129 // Like in `ZipArchiveFileLookup` we assume that zips are immutable
130130 private val zipClassPathClasses : Seq [String ] = zipClassPaths.flatMap { zipCp =>
131- new ZipFile (zipCp.zipFile)
132- .stream
133- .toArray((size : Int ) => new Array [ZipEntry ](size))
134- .map((e : ZipEntry ) => e.getName)
135- .flatMap((name : String ) => tastySuffixes.find(name.endsWith).map(name.replace(" /" , " ." ).stripSuffix))
131+ val zipFile = new ZipFile (zipCp.zipFile)
132+
133+ try {
134+ for {
135+ entry <- zipFile.stream.iterator().asScala
136+ name = entry.getName
137+ tastySuffix <- tastySuffixes
138+ if name.endsWith(tastySuffix)
139+ } yield name.replace(" /" , " ." ).stripSuffix(tastySuffix)
140+ }
141+ finally zipFile.close()
136142 }
137143
138144 // FIXME: classfiles in directories may change at any point, so we retraverse
Original file line number Diff line number Diff line change @@ -165,11 +165,9 @@ class DottyLanguageServer extends LanguageServer
165165 // Do most of the initialization asynchronously so that we can return early
166166 // from this method and thus let the client know our capabilities.
167167 CompletableFuture .supplyAsync(() => drivers)
168- .exceptionally {
169- (ex : Throwable ) => {
170- ex.printStackTrace
171- sys.exit(1 )
172- }
168+ .exceptionally { (ex : Throwable ) =>
169+ ex.printStackTrace
170+ sys.exit(1 )
173171 }
174172
175173 new InitializeResult (c)
You can’t perform that action at this time.
0 commit comments