Skip to content

Commit

Permalink
Ignore scala.reflect.io.FileZipArchive$LeakyEntry
Browse files Browse the repository at this point in the history
Fixes #857

If the symbols are not from VirtualFile, we should be able to ignore it.
  • Loading branch information
eed3si9n committed Jul 27, 2020
1 parent 605f12e commit d3141f7
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions internal/compiler-bridge/src/main/scala/xsbt/API.scala
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,14 @@ final class API(val global: CallbackGlobal) extends Compat with GlobalHelpers wi
def registerGeneratedClasses(classSymbols: Iterator[Symbol]): Unit = {
classSymbols.foreach { symbol =>
val sourceFile = symbol.sourceFile
val sourceJavaFile0 =
val sourceVF0 =
if (sourceFile == null) symbol.enclosingTopLevelClass.sourceFile
else sourceFile
val sourceJavaFile: VirtualFile = sourceJavaFile0 match { case AbstractZincFile(vf) => vf }
val sourceVF: Option[VirtualFile] = sourceVF0 match {
case AbstractZincFile(vf) => Some(vf)
// This could be scala.reflect.io.FileZipArchive$LeakyEntry
case _ => None
}

def registerProductNames(names: FlattenedNames): Unit = {
// Guard against a local class in case it surreptitiously leaks here
Expand All @@ -148,12 +152,14 @@ final class API(val global: CallbackGlobal) extends Compat with GlobalHelpers wi
}
val zincClassName = names.className
val srcClassName = classNameAsString(symbol)
callback.generatedNonLocalClass(
sourceJavaFile,
classFile.toPath,
zincClassName,
srcClassName
)
sourceVF foreach { source =>
callback.generatedNonLocalClass(
source,
classFile.toPath,
zincClassName,
srcClassName
)
}
} else ()
}

Expand Down

0 comments on commit d3141f7

Please sign in to comment.