catch NoSuchMethodError when call runFinalization

This commit is contained in:
kenji yoshida 2023-10-08 18:04:06 +09:00 committed by GitHub
parent 5d6d30ed1c
commit 32558c9537
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 {