diff options
author | Paul Phillips <paulp@improving.org> | 2012-01-26 08:40:04 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-01-26 11:26:36 -0800 |
commit | 67420a8fa31c4570542450238b97e5ca1b54a86f (patch) | |
tree | 49d2760b1267c732eba1e06eb03140428a6379a0 /src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala | |
parent | a7aeddd038bead9cda67a85a922a7988b459ff04 (diff) | |
download | scala-67420a8fa31c4570542450238b97e5ca1b54a86f.tar.gz scala-67420a8fa31c4570542450238b97e5ca1b54a86f.tar.bz2 scala-67420a8fa31c4570542450238b97e5ca1b54a86f.zip |
Intercept assert and require calls.
And abort calls, and unhandled exceptions, all so I can supplement the
error message with a little of the vast quantity of useful information
which we possess but do not reveal. "Details are sketchy," says the
officer tasked with investigating the crash, but no longer. Also took
the opportunity to eliminate a bunch of one-argument assertions and
requirements if I thought there was any chance I'd someday be facing
them on the wrong end of an incident.
Have you ever dreamed that instead of this experience:
% scalac -optimise <long list of files>
error: java.lang.AssertionError: assertion failed: Record Record(anonymous class JavaToScala$$anonfun$makeScalaPackage$1,Map()) does not contain a field value owner$1
Things could proceed more like this:
% scalac -optimise <long list of files>
error:
while compiling: src/compiler/scala/reflect/runtime/JavaToScala.scala
current phase: closelim
library version: version 2.10.0.rdev-4267-2012-01-25-gc94d342
compiler version: version 2.10.0.rdev-4270-2012-01-26-gd540ddf
reconstructed args: -Ydead-code -optimise -Yinline -Yclosure-elim -Yinline-handlers -d /tmp
error: java.lang.AssertionError: [etc]
You are not dreaming! IT'S ALL HAPPENING
Diffstat (limited to 'src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala index 3c97122c9c..7d42dabc08 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala @@ -434,7 +434,7 @@ abstract class ICodeReader extends ClassfileParser { val padding = if ((pc + size) % 4 != 0) 4 - ((pc + size) % 4) else 0 size += padding in.bp += padding - assert((pc + size % 4) != 0) + assert((pc + size % 4) != 0, pc) /* var byte1 = in.nextByte; size += 1; while (byte1 == 0) { byte1 = in.nextByte; size += 1; } val default = byte1 << 24 | in.nextByte << 16 | in.nextByte << 8 | in.nextByte; @@ -454,7 +454,7 @@ abstract class ICodeReader extends ClassfileParser { val padding = if ((pc + size) % 4 != 0) 4 - ((pc + size) % 4) else 0 size += padding in.bp += padding - assert((pc + size % 4) != 0) + assert((pc + size % 4) != 0, pc) val default = pc + in.nextInt; size += 4 val npairs = in.nextInt; size += 4 var tags: List[List[Int]] = Nil @@ -988,7 +988,7 @@ abstract class ICodeReader extends ClassfileParser { def enterParam(idx: Int, kind: TypeKind) = { val sym = method.symbol.newVariable(newTermName("par" + idx)).setInfo(kind.toType) val l = new Local(sym, kind, true) - assert(!locals.isDefinedAt(idx)) + assert(!locals.isDefinedAt(idx), locals(idx)) locals += (idx -> List((l, kind))) l } |