diff options
Diffstat (limited to 'src')
5 files changed, 12 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 35bf2dd288..327a864e3b 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -319,7 +319,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) def ccon = Class.forName(name).getConstructor(classOf[CharsetDecoder], classOf[Reporter]) try Some(ccon.newInstance(charset.newDecoder(), reporter).asInstanceOf[SourceReader]) - catch { case x => + catch { case x: Exception => globalError("exception while trying to instantiate source reader '" + name + "'") None } diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index 82ce59d075..8f287a5c7a 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -485,8 +485,8 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "") } catch { case ex: FreshRunReq => throw ex // propagate a new run request case ShutdownReq => throw ShutdownReq // propagate a shutdown request - - case ex => + case ex: ControlThrowable => throw ex + case ex: Throwable => println("[%s]: exception during background compile: ".format(unit.source) + ex) ex.printStackTrace() for (r <- waitLoadedTypeResponses(unit.source)) { @@ -755,7 +755,9 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "") val tp1 = pre.memberType(alt) onTypeError NoType val tp2 = adaptToNewRunMap(sym.tpe) substSym (originalTypeParams, sym.owner.typeParams) matchesType(tp1, tp2, false) - } catch { + } + catch { + case ex: ControlThrowable => throw ex case ex: Throwable => println("error in hyperlinking: " + ex) ex.printStackTrace() diff --git a/src/compiler/scala/tools/nsc/interpreter/ILoopInit.scala b/src/compiler/scala/tools/nsc/interpreter/ILoopInit.scala index 37e4dfaea4..7f5e09842a 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ILoopInit.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ILoopInit.scala @@ -93,7 +93,7 @@ trait ILoopInit { postInitThunks foreach (f => addThunk(f())) runThunks() } catch { - case ex => + case ex: Throwable => val message = new java.io.StringWriter() ex.printStackTrace(new java.io.PrintWriter(message)) initError = message.toString diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala index 2a7adbe781..b385787cce 100644 --- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala +++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala @@ -751,7 +751,7 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends private def load(path: String): Class[_] = { try Class.forName(path, true, classLoader) - catch { case ex => evalError(path, unwrap(ex)) } + catch { case ex: Throwable => evalError(path, unwrap(ex)) } } var evalCaught: Option[Throwable] = None @@ -989,7 +989,7 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends /** load and run the code using reflection */ def loadAndRun: (String, Boolean) = { try { ("" + (lineRep call sessionNames.print), true) } - catch { case ex => (lineRep.bindError(ex), false) } + catch { case ex: Throwable => (lineRep.bindError(ex), false) } } override def toString = "Request(line=%s, %s trees)".format(line, trees.size) diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplConfig.scala b/src/compiler/scala/tools/nsc/interpreter/ReplConfig.scala index 0c26aa8b28..adb1a2be04 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ReplConfig.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ReplConfig.scala @@ -6,6 +6,7 @@ package scala.tools.nsc package interpreter +import scala.util.control.ControlThrowable import util.Exceptional.unwrap import util.stackTraceString @@ -38,7 +39,8 @@ trait ReplConfig { private[nsc] def replinfo(msg: => String) = if (isReplInfo) echo(msg) private[nsc] def logAndDiscard[T](label: String, alt: => T): PartialFunction[Throwable, T] = { - case t => + case t: ControlThrowable => throw t + case t: Throwable => repldbg(label + ": " + unwrap(t)) repltrace(stackTraceString(unwrap(t))) alt |