Fix DefinesClass implementation for jdk > 8

When trying to use any jdk > 8 with the latest sbt, sbt will die in some
projects because it tries to call Locate.defineClass on rt.jar, which
is represented with a DummyVirtualFile and causes a crash.
This commit is contained in:
Ethan Atkins 2020-04-30 20:04:58 -07:00
parent 924d8e75cf
commit 7d07bbabbf
1 changed files with 2 additions and 1 deletions

View File

@ -179,7 +179,8 @@ object Defaults extends BuildCommon {
classpathEntryDefinesClass := {
val converter = fileConverter.value
val f = FileValueCache({ x: NioPath =>
Locate.definesClass(converter.toVirtualFile(x))
if (x.getFileName.toString != "rt.jar") Locate.definesClass(converter.toVirtualFile(x))
else ((_: String) => false): DefinesClass
}).get;
{ (x: File) =>
f(x.toPath)