From 63895a3d77766bcbd8fb9ce86b98746cb93a0a5c Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Sat, 19 May 2012 18:20:20 -0400 Subject: [PATCH] source compatibility with 2.8.1, where resident mode can't be supported --- compile/interface/CompilerInterface.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/compile/interface/CompilerInterface.scala b/compile/interface/CompilerInterface.scala index f422f4343..5babedd3a 100644 --- a/compile/interface/CompilerInterface.scala +++ b/compile/interface/CompilerInterface.scala @@ -146,7 +146,8 @@ private final class CachedCompiler0(args: Array[String], initialLog: WeakLog) ex } // Required because computePhaseDescriptors is private in 2.8 (changed to protected sometime later). private[this] def superComputePhaseDescriptors() = superCall("computePhaseDescriptors").asInstanceOf[List[SubComponent]] - private[this] def superDropRun(): Unit = superCall("dropRun") + private[this] def superDropRun(): Unit = + try { superCall("dropRun") } catch { case e: NoSuchMethodException => () } // dropRun not in 2.8.1, so resident mode not supported private[this] def superCall(methodName: String): AnyRef = { val meth = classOf[Global].getDeclaredMethod(methodName) @@ -203,6 +204,12 @@ private final class CachedCompiler0(args: Array[String], initialLog: WeakLog) ex def reloadClass(pkg: Symbol, simpleName: String, bin: AbstractFile) { val loader = new loaders.ClassfileLoader(bin) + // enterClass/enterModule not in 2.8.1, so resident mode can't be supported + object LoadersCompat { + def enterClass(pkg: Any, simpleName: Any, loader: Any): Symbol = NoSymbol + def enterModule(pkg: Any, simpleName: Any, loader: Any): Symbol = NoSymbol + } + implicit def compat(run: AnyRef): LoadersCompat.type = LoadersCompat toForget += loaders.enterClass(pkg, simpleName, loader) toForget += loaders.enterModule(pkg, simpleName, loader) }