summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2011-04-21 09:31:18 +0000
committerMartin Odersky <odersky@gmail.com>2011-04-21 09:31:18 +0000
commit9388a634f5937d2ac626a884df9d7957a18ccbdc (patch)
tree3cd579b2e05e25fb3a0807a9bc1338968e3108a9 /src
parentfe15d7eed77ce8529b6785e9e83ff6f955b3d5c1 (diff)
downloadscala-9388a634f5937d2ac626a884df9d7957a18ccbdc.tar.gz
scala-9388a634f5937d2ac626a884df9d7957a18ccbdc.tar.bz2
scala-9388a634f5937d2ac626a884df9d7957a18ccbdc.zip
Made FreshRunReq a traceable exception, so that...
Made FreshRunReq a traceable exception, so that we can better spot problems in the IDE.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/interactive/CompilerControl.scala4
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Global.scala7
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Picklers.scala9
-rw-r--r--src/compiler/scala/tools/nsc/interactive/PresentationCompilerThread.scala4
4 files changed, 15 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
index 64178b5eac..0c5d85d2a8 100644
--- a/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
+++ b/src/compiler/scala/tools/nsc/interactive/CompilerControl.scala
@@ -199,7 +199,7 @@ trait CompilerControl { self: Global =>
/** Cancels current compiler run and start a fresh one where everything will be re-typechecked
* (but not re-loaded).
*/
- def askReset() = scheduler raise FreshRunReq
+ def askReset() = scheduler raise (new FreshRunReq)
/** Tells the compile server to shutdown, and not to restart again */
def askShutdown() = scheduler raise ShutdownReq
@@ -307,7 +307,7 @@ trait CompilerControl { self: Global =>
/** Signals a request for a fresh background compiler run.
* Note: The object has to stay top-level so that the PresentationCompilerThread may access it.
*/
-object FreshRunReq extends ControlThrowable
+class FreshRunReq extends ControlThrowable
/** Signals a request for a shutdown of the presentation compiler.
* Note: The object has to stay top-level so that the PresentationCompilerThread may access it.
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index 9b50b82bb3..2b920c8c03 100644
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -173,7 +173,7 @@ class Global(settings: Settings, reporter: Reporter, projectName: String = "")
def isOutOfDate: Boolean = outOfDate
def demandNewCompilerRun() = {
- if (outOfDate) throw FreshRunReq // cancel background compile
+ if (outOfDate) throw new FreshRunReq // cancel background compile
else outOfDate = true // proceed normally and enable new background compile
}
@@ -316,7 +316,7 @@ class Global(settings: Settings, reporter: Reporter, projectName: String = "")
}
logreplay("exception thrown", scheduler.pollThrowable()) match {
- case Some(ex @ FreshRunReq) =>
+ case Some(ex: FreshRunReq) =>
newTyperRun()
minRunId = currentRunId
demandNewCompilerRun()
@@ -537,9 +537,10 @@ class Global(settings: Settings, reporter: Reporter, projectName: String = "")
} catch {
case CancelException =>
debugLog("cancelled")
- case ex @ FreshRunReq =>
+ case ex: FreshRunReq =>
if (debugIDE) {
println("FreshRunReq thrown during response")
+ ex.printStackTrace()
}
response raise ex
throw ex
diff --git a/src/compiler/scala/tools/nsc/interactive/Picklers.scala b/src/compiler/scala/tools/nsc/interactive/Picklers.scala
index 53ef20507f..561fa47e94 100644
--- a/src/compiler/scala/tools/nsc/interactive/Picklers.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Picklers.scala
@@ -16,8 +16,13 @@ import mutable.ListBuffer
trait Picklers { self: Global =>
- lazy val freshRunReq = singletonPickler(FreshRunReq)
- lazy val shutdownReq = singletonPickler(ShutdownReq)
+ lazy val freshRunReq =
+ unitPickler
+ .wrapped { _ => new FreshRunReq } { x => () }
+ .labelled ("FreshRunReq")
+ .cond (_.isInstanceOf[FreshRunReq])
+
+ lazy val shutdownReq = singletonPickler(ShutdownReq)
def defaultThrowable[T <: Throwable]: CondPickler[T] = javaInstancePickler[T] cond { _ => true }
diff --git a/src/compiler/scala/tools/nsc/interactive/PresentationCompilerThread.scala b/src/compiler/scala/tools/nsc/interactive/PresentationCompilerThread.scala
index 4ba0208c39..098884dab1 100644
--- a/src/compiler/scala/tools/nsc/interactive/PresentationCompilerThread.scala
+++ b/src/compiler/scala/tools/nsc/interactive/PresentationCompilerThread.scala
@@ -24,7 +24,7 @@ final class PresentationCompilerThread(var compiler: Global, name: String = "")
try {
compiler.backgroundCompile()
} catch {
- case FreshRunReq =>
+ case ex: FreshRunReq =>
compiler.debugLog("fresh run req caught, starting new pass")
}
compiler.log.flush()
@@ -40,7 +40,7 @@ final class PresentationCompilerThread(var compiler: Global, name: String = "")
compiler.log.flush()
ex match {
- case FreshRunReq =>
+ case ex: FreshRunReq =>
compiler.debugLog("fresh run req caught outside presentation compiler loop; ignored") // This shouldn't be reported
case _ : Global#ValidateException => // This will have been reported elsewhere
compiler.debugLog("validate exception caught outside presentation compiler loop; ignored")