summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon Ochsenreither <simon@ochsenreither.de>2013-11-22 20:02:08 +0100
committerSimon Ochsenreither <simon@ochsenreither.de>2013-11-22 20:02:08 +0100
commit64603653f82082431941cb29ad317b669822f28e (patch)
treea0be7a449a31414e5e2c1fe05fc7378d82aaf02c /src
parentad5fa95d55096e498c461471528d957ffc82706c (diff)
downloadscala-64603653f82082431941cb29ad317b669822f28e.tar.gz
scala-64603653f82082431941cb29ad317b669822f28e.tar.bz2
scala-64603653f82082431941cb29ad317b669822f28e.zip
SI-7999 s.u.c.NonFatal: StackOverflowError is fatal
As demonstrated in https://groups.google.com/d/topic/scala-language/eC9dqTTBYHg, SOEs should be considered fatal, because all popular JVM implementations seem to run into inconsistent state (ignoring finally blocks leading to not running monitorExit, leading to locks not being unlocked, ...) if one just pushes them enough.
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/util/control/NonFatal.scala4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/library/scala/util/control/NonFatal.scala b/src/library/scala/util/control/NonFatal.scala
index 11fb988e8e..9d3dfea074 100644
--- a/src/library/scala/util/control/NonFatal.scala
+++ b/src/library/scala/util/control/NonFatal.scala
@@ -11,9 +11,8 @@ package util.control
/**
* Extractor of non-fatal Throwables. Will not match fatal errors like `VirtualMachineError`
- * (for example, `OutOfMemoryError`, a subclass of `VirtualMachineError`), `ThreadDeath`,
+ * (for example, `OutOfMemoryError` and `StackOverflowError`, subclasses of `VirtualMachineError`), `ThreadDeath`,
* `LinkageError`, `InterruptedException`, `ControlThrowable`.
- * However, `StackOverflowError` is matched, i.e. considered non-fatal.
*
* Note that [[scala.util.control.ControlThrowable]], an internal Throwable, is not matched by
* `NonFatal` (and would therefore be thrown).
@@ -34,7 +33,6 @@ object NonFatal {
* Returns true if the provided `Throwable` is to be considered non-fatal, or false if it is to be considered fatal
*/
def apply(t: Throwable): Boolean = t match {
- case _: StackOverflowError => true // StackOverflowError ok even though it is a VirtualMachineError
// VirtualMachineError includes OutOfMemoryError and other fatal errors
case _: VirtualMachineError | _: ThreadDeath | _: InterruptedException | _: LinkageError | _: ControlThrowable => false
case _ => true