Apply exception handler inlining to a class
Apply exception handler inlining to a class
Is current phase cancelled on this unit?
Is current phase cancelled on this unit?
Finds the first exception handler that matches the current exception
Finds the first exception handler that matches the current exception
Note the following code:
try { throw new IllegalArgumentException("...") } catch { case e: RuntimeException => log("RuntimeException") case i: IllegalArgumentException => log("IllegalArgumentException") }
will print "RuntimeException" => we need the *first* valid handler
There's a hidden catch here: say we have the following code:
try { val exception: Throwable = if (scala.util.Random.nextInt % 2 == 0) new IllegalArgumentException("even") else new StackOverflowError("odd") throw exception } catch { case e: IllegalArgumentException => println("Correct, IllegalArgumentException") case e: StackOverflowError => println("Correct, StackOverflowException") case t: Throwable => println("WROOOONG, not Throwable!") }
We don't want to select a handler if there's at least one that's more specific!
This is used only in unsafeTypeParams, and at this writing is overridden to false in namer, typer, and erasure.
This is used only in unsafeTypeParams, and at this writing is overridden to false in namer, typer, and erasure. (And NoPhase.)
New flags visible once this phase has started
New flags visible once this phase has started
New flags visible after this phase has completed
New flags visible after this phase has completed
Inlining Exception Handlers