diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-11 17:05:41 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan@feather.local> | 2013-12-12 10:30:56 -0800 |
commit | 3fa2c97853de2110227f50982187b4377b8772bc (patch) | |
tree | 92cd1426843ef3274b46076dc46164e62d012fec /src/asm | |
parent | 2aa9da578e03987427a2d932becc75fc0f016d8b (diff) | |
download | scala-3fa2c97853de2110227f50982187b4377b8772bc.tar.gz scala-3fa2c97853de2110227f50982187b4377b8772bc.tar.bz2 scala-3fa2c97853de2110227f50982187b4377b8772bc.zip |
Report error on code size overflow, log method name.
We used to silently skip class files that would exceed the JVM's size limits.
While rare, this should still be an error.
While I was at it, also included the name of the offending method.
Diffstat (limited to 'src/asm')
-rw-r--r-- | src/asm/scala/tools/asm/MethodWriter.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/asm/scala/tools/asm/MethodWriter.java b/src/asm/scala/tools/asm/MethodWriter.java index 321bacb6fc..887cb28c6f 100644 --- a/src/asm/scala/tools/asm/MethodWriter.java +++ b/src/asm/scala/tools/asm/MethodWriter.java @@ -1853,7 +1853,12 @@ class MethodWriter extends MethodVisitor { int size = 8; if (code.length > 0) { if (code.length > 65536) { - throw new RuntimeException("Method code too large!"); + String nameString = ""; + int i = 0; + // find item that corresponds to the index of our name + while (i < cw.items.length && (cw.items[i] == null || cw.items[i].index != name)) i++; + if (cw.items[i] != null) nameString = cw.items[i].strVal1 +"'s "; + throw new RuntimeException("Method "+ nameString +"code too large!"); } cw.newUTF8("Code"); size += 18 + code.length + 8 * handlerCount; |