X-Git-Url: http://git.megacz.com/?p=org.ibex.classgen.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fclassgen%2FMethodGen.java;h=ef40595c82287c4be889e97590ec72c3023c970f;hp=94f0fadcf5734dfc4e46af79a4446d72a6706d85;hb=ddf408851103280fd02c37c7afd806a94b2a3ec3;hpb=11cdbef43dc7391d2e1a7d38a38994934a504d34 diff --git a/src/org/ibex/classgen/MethodGen.java b/src/org/ibex/classgen/MethodGen.java index 94f0fad..ef40595 100644 --- a/src/org/ibex/classgen/MethodGen.java +++ b/src/org/ibex/classgen/MethodGen.java @@ -15,8 +15,8 @@ public class MethodGen extends Type.Class.Method.Body { private final Vector exnTable = new Vector(); private final Hashtable thrownExceptions = new Hashtable(); - private int maxStack = 16; - private int maxLocals; + int maxStack = 16; + int maxLocals; private int size; private int capacity; @@ -133,7 +133,7 @@ public class MethodGen extends Type.Class.Method.Body { break; } case MULTIANEWARRAY: - arg = new MultiANewArray((Type.Class)cp.getKeyByIndex(in.readUnsignedShort()),in.readUnsignedByte()); + arg = new MultiANewArray((Type.Array)cp.getKeyByIndex(in.readUnsignedShort()),in.readUnsignedByte()); break; case INVOKEINTERFACE: { ConstantPool.Ent ent = cp.getByIndex(in.readUnsignedShort()); @@ -532,9 +532,9 @@ public class MethodGen extends Type.Class.Method.Body { } public static class MultiANewArray { - public Type.Class type; + public Type.Array type; public int dims; - public MultiANewArray(Type.Class type, int dims) { this.type = type; this.dims = dims; } + public MultiANewArray(Type.Array type, int dims) { this.type = type; this.dims = dims; } } public static class Wide { @@ -842,7 +842,9 @@ public class MethodGen extends Type.Class.Method.Body { } else if (argLength == 7) { throw new Error("should never happen - variable length instruction not explicitly handled"); } else { - int iarg = ((Integer)arg).intValue(); + int iarg = (arg instanceof Type.Primitive) + ? ((Type.Primitive)arg).toArraySpec() + : ((Integer)arg).intValue(); if (argLength == 1) { if ((opdata & OP_UNSIGNED_FLAG) != 0 ? iarg >= 256 : (iarg < -128 || iarg >= 128)) throw new ClassFile.Exn("overflow of s/u1 option"); @@ -996,9 +998,9 @@ public class MethodGen extends Type.Class.Method.Body { sb.append(i).append(": "); sb.append(OP_NAMES[op[i]&0xff]); String s = null; - if (arg[i] instanceof Type) s = ((Type)arg[i]).debugToString(); - else if (arg[i] instanceof Type.Class.Member) s = ((Type.Class.Member)arg[i]).debugToString(); - else if (arg[i] instanceof String) s = "\"" + s + "\""; + if (arg[i] instanceof Type) s = ((Type)arg[i]).toString(); + else if (arg[i] instanceof Type.Class.Member) s = ((Type.Class.Member)arg[i]).toString(); + else if (arg[i] instanceof String) s = "\"" + arg[i] + "\""; else if (arg[i] != null) s = arg[i].toString(); if (s != null) sb.append(" ").append(s); sb.append("\n");