Skip to content

Commit

Permalink
Prefer NonFatal to catch-all
Browse files Browse the repository at this point in the history
  • Loading branch information
som-snytt authored and lrytz committed Dec 7, 2023
1 parent bee5534 commit 47e1f65
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import scala.tools.nsc.CloseableRegistry
import scala.tools.nsc.classpath.PackageNameUtils.{packageContains, separatePkgAndClassNames}
import scala.tools.nsc.util.{ClassPath, ClassRepresentation, EfficientClassPath}
import scala.util.Properties.{isJavaAtLeast, javaHome}
import scala.util.control.NonFatal
import FileUtils._

/**
Expand Down Expand Up @@ -168,7 +169,7 @@ object JrtClassPath {
List(classPath)
}
} catch {
case _: Throwable => Nil
case NonFatal(_) => Nil
}
private def createJrt(closeableRegistry: CloseableRegistry): List[JrtClassPath] =
try {
Expand Down
2 changes: 1 addition & 1 deletion test/files/neg/unsafe.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// scalac: --release:8 -Yopen-packages:java.lang
// javaVersion: 19+

// -Yunsafe opens packages but does not override class definitions
// -Yopen-packages opens packages but does not override class definitions
// because ct.sym comes first

class C {
Expand Down

0 comments on commit 47e1f65

Please sign in to comment.