Merge pull request #7399 from xuwei-k/System-runFinalization

catch `NoSuchMethodError` when call `runFinalization`
This commit is contained in:
eugene yokota 2023-10-08 13:45:45 -04:00 committed by GitHub
commit c48c1f66de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -37,7 +37,11 @@ private[sbt] object GCUtil {
// Force the detection of finalizers for scala.reflect weakhashsets
System.gc()
// Force finalizers to run.
System.runFinalization()
try {
System.runFinalization()
} catch {
case _: NoSuchMethodError =>
}
// Force actually cleaning the weak hash maps.
System.gc()
} catch {