summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala')
-rw-r--r--src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
index 815b4705bd..94d9bca945 100644
--- a/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
+++ b/src/compiler/scala/tools/nsc/symtab/classfile/UnPickler.scala
@@ -14,6 +14,7 @@ import Flags._
import scala.reflect.generic.PickleFormat._
import collection.mutable.{HashMap, ListBuffer}
import annotation.switch
+import java.io.IOException
/** @author Martin Odersky
* @version 1.0
@@ -58,6 +59,17 @@ abstract class UnPickler extends reflect.generic.UnPickler {
def toTypeError(e: MissingRequirementError) =
new TypeError(e.msg)
+ /** Convert to a type error, that is printed gracefully instead of crashing.
+ *
+ * Similar in intent to what SymbolLoader does (but here we don't have access to
+ * error reporting, so we rely on the typechecker to report the error).
+ *
+ * @note Unlike 2.10, 2.9 may throw either IOException or MissingRequirementError. This
+ * simply tries to make it more robust.
+ */
+ def toTypeError(e: IOException) =
+ new TypeError(e.getMessage)
+
/** A lazy type which when completed returns type at index `i`. */
private class LazyTypeRef(i: Int) extends LazyType {
private val definedAtRunId = currentRunId
@@ -69,6 +81,7 @@ abstract class UnPickler extends reflect.generic.UnPickler {
if (currentRunId != definedAtRunId) sym.setInfo(adaptToNewRunMap(tp))
} catch {
case e: MissingRequirementError => throw toTypeError(e)
+ case e: IOException => throw toTypeError(e)
}
override def load(sym: Symbol) { complete(sym) }
}
@@ -88,6 +101,7 @@ abstract class UnPickler extends reflect.generic.UnPickler {
sym.asInstanceOf[TermSymbol].setAlias(alias)
} catch {
case e: MissingRequirementError => throw toTypeError(e)
+ case e: IOException => throw toTypeError(e)
}
}
}