diff -N -a -u -r -b bcel-5.1/build.xml bcel/build.xml --- bcel-5.1/build.xml 2003-04-25 09:06:14.000000000 -0700 +++ bcel/build.xml 2004-01-29 04:37:15.593750000 -0800 @@ -65,7 +65,7 @@ <target name="build" depends="compile"/> <!-- Jar the library --> - <target name="jar" depends="examples"> + <target name="jar" depends="init,compile"> <jar jarfile="${build.dir}/${name}.jar" basedir="${build.dest}" manifest="${basedir}/manifest.txt" diff -N -a -u -r -b bcel-5.1/manifest.txt bcel/manifest.txt --- bcel-5.1/manifest.txt 1969-12-31 16:00:00.000000000 -0800 +++ bcel/manifest.txt 2004-01-29 04:37:15.609375000 -0800 @@ -0,0 +1,3 @@ +Created-By: Jakarta BCEL 5.1 +Manifest-Version: 1.0 +Main-Class: listclass diff -N -a -u -r -b bcel-5.1/src/java/org/apache/bcel/generic/Instruction.java bcel/src/java/org/apache/bcel/generic/Instruction.java --- bcel-5.1/src/java/org/apache/bcel/generic/Instruction.java 2003-04-25 09:06:16.000000000 -0700 +++ bcel/src/java/org/apache/bcel/generic/Instruction.java 2004-01-29 04:37:15.640625000 -0800 @@ -190,26 +190,223 @@ Class clazz; try { - clazz = Class.forName(className(opcode)); - } catch (ClassNotFoundException cnfe){ - // If a class by that name does not exist, the opcode is illegal. - // Note that IMPDEP1, IMPDEP2, BREAKPOINT are also illegal in a sense. - throw new ClassGenException("Illegal opcode detected."); + switch(opcode) { + case Constants.NOP: obj = new NOP(); break; + case Constants.ACONST_NULL: obj = new ACONST_NULL(); break; + case Constants.ICONST_M1: + case Constants.ICONST_0: + case Constants.ICONST_1: + case Constants.ICONST_2: + case Constants.ICONST_3: + case Constants.ICONST_4: + case Constants.ICONST_5: obj = new ICONST(); break; + case Constants.LCONST_0: + case Constants.LCONST_1: obj = new LCONST(); break; + case Constants.FCONST_0: + case Constants.FCONST_1: + case Constants.FCONST_2: obj = new FCONST(); break; + case Constants.DCONST_0: + case Constants.DCONST_1: obj = new DCONST(); break; + case Constants.BIPUSH : obj = new BIPUSH(); break; + case Constants.SIPUSH : obj = new SIPUSH(); break; + case Constants.LDC : obj = new LDC(); break; + case Constants.LDC_W: obj = new LDC_W(); break; + case Constants.LDC2_W: obj = new LDC2_W(); break; + case Constants.ILOAD : obj = new ILOAD(); break; + case Constants.LLOAD : obj = new LLOAD(); break; + case Constants.FLOAD : obj = new FLOAD(); break; + case Constants.DLOAD : obj = new DLOAD(); break; + case Constants.ALOAD : obj = new ALOAD(); break; + case Constants.ILOAD_0: + case Constants.ILOAD_1: + case Constants.ILOAD_2: + case Constants.ILOAD_3: obj = new ILOAD(); break; + case Constants.LLOAD_0: + case Constants.LLOAD_1: + case Constants.LLOAD_2: + case Constants.LLOAD_3: obj = new LLOAD(); break; + case Constants.FLOAD_0: + case Constants.FLOAD_1: + case Constants.FLOAD_2: + case Constants.FLOAD_3: obj = new FLOAD(); break; + case Constants.DLOAD_0: + case Constants.DLOAD_1: + case Constants.DLOAD_2: + case Constants.DLOAD_3: obj = new DLOAD(); break; + case Constants.ALOAD_0: + case Constants.ALOAD_1: + case Constants.ALOAD_2: + case Constants.ALOAD_3: obj = new ALOAD(); break; + case Constants.IALOAD : obj = new IALOAD(); break; + case Constants.LALOAD : obj = new LALOAD(); break; + case Constants.FALOAD : obj = new FALOAD(); break; + case Constants.DALOAD : obj = new DALOAD(); break; + case Constants.AALOAD : obj = new AALOAD(); break; + case Constants.BALOAD : obj = new BALOAD(); break; + case Constants.CALOAD : obj = new CALOAD(); break; + case Constants.SALOAD : obj = new SALOAD(); break; + case Constants.ISTORE : obj = new ISTORE(); break; + case Constants.LSTORE : obj = new LSTORE(); break; + case Constants.FSTORE : obj = new FSTORE(); break; + case Constants.DSTORE : obj = new DSTORE(); break; + case Constants.ASTORE : obj = new ASTORE(); break; + case Constants.ISTORE_0: + case Constants.ISTORE_1: + case Constants.ISTORE_2: + case Constants.ISTORE_3: obj = new ISTORE(); break; + case Constants.LSTORE_0: + case Constants.LSTORE_1: + case Constants.LSTORE_2: + case Constants.LSTORE_3: obj = new LSTORE(); break; + case Constants.FSTORE_0: + case Constants.FSTORE_1: + case Constants.FSTORE_2: + case Constants.FSTORE_3: obj = new FSTORE(); break; + case Constants.DSTORE_0: + case Constants.DSTORE_1: + case Constants.DSTORE_2: + case Constants.DSTORE_3: obj = new DSTORE(); break; + case Constants.ASTORE_0: + case Constants.ASTORE_1: + case Constants.ASTORE_2: + case Constants.ASTORE_3: obj = new ASTORE(); break; + case Constants.IASTORE : obj = new IASTORE(); break; + case Constants.LASTORE : obj = new LASTORE(); break; + case Constants.FASTORE : obj = new FASTORE(); break; + case Constants.DASTORE : obj = new DASTORE(); break; + case Constants.AASTORE : obj = new AASTORE(); break; + case Constants.BASTORE : obj = new BASTORE(); break; + case Constants.CASTORE : obj = new CASTORE(); break; + case Constants.SASTORE : obj = new SASTORE(); break; + case Constants.POP : obj = new POP(); break; + case Constants.POP2 : obj = new POP2(); break; + case Constants.DUP : obj = new DUP(); break; + case Constants.DUP_X1: obj = new DUP_X1(); break; + case Constants.DUP_X2: obj = new DUP_X2(); break; + case Constants.DUP2 : obj = new DUP2(); break; + case Constants.DUP2_X1: obj = new DUP2_X1(); break; + case Constants.DUP2_X2: obj = new DUP2_X2(); break; + case Constants.SWAP : obj = new SWAP(); break; + case Constants.IADD : obj = new IADD(); break; + case Constants.LADD : obj = new LADD(); break; + case Constants.FADD : obj = new FADD(); break; + case Constants.DADD : obj = new DADD(); break; + case Constants.ISUB : obj = new ISUB(); break; + case Constants.LSUB : obj = new LSUB(); break; + case Constants.FSUB : obj = new FSUB(); break; + case Constants.DSUB : obj = new DSUB(); break; + case Constants.IMUL : obj = new IMUL(); break; + case Constants.LMUL : obj = new LMUL(); break; + case Constants.FMUL : obj = new FMUL(); break; + case Constants.DMUL : obj = new DMUL(); break; + case Constants.IDIV : obj = new IDIV(); break; + case Constants.LDIV : obj = new LDIV(); break; + case Constants.FDIV : obj = new FDIV(); break; + case Constants.DDIV : obj = new DDIV(); break; + case Constants.IREM : obj = new IREM(); break; + case Constants.LREM : obj = new LREM(); break; + case Constants.FREM : obj = new FREM(); break; + case Constants.DREM : obj = new DREM(); break; + case Constants.INEG : obj = new INEG(); break; + case Constants.LNEG : obj = new LNEG(); break; + case Constants.FNEG : obj = new FNEG(); break; + case Constants.DNEG : obj = new DNEG(); break; + case Constants.ISHL : obj = new ISHL(); break; + case Constants.LSHL : obj = new LSHL(); break; + case Constants.ISHR : obj = new ISHR(); break; + case Constants.LSHR : obj = new LSHR(); break; + case Constants.IUSHR : obj = new IUSHR(); break; + case Constants.LUSHR : obj = new LUSHR(); break; + case Constants.IAND : obj = new IAND(); break; + case Constants.LAND : obj = new LAND(); break; + case Constants.IOR : obj = new IOR(); break; + case Constants.LOR : obj = new LOR(); break; + case Constants.IXOR : obj = new IXOR(); break; + case Constants.LXOR : obj = new LXOR(); break; + case Constants.IINC : obj = new IINC(); break; + case Constants.I2L : obj = new I2L(); break; + case Constants.I2F : obj = new I2F(); break; + case Constants.I2D : obj = new I2D(); break; + case Constants.L2I : obj = new L2I(); break; + case Constants.L2F : obj = new L2F(); break; + case Constants.L2D : obj = new L2D(); break; + case Constants.F2I : obj = new F2I(); break; + case Constants.F2L : obj = new F2L(); break; + case Constants.F2D : obj = new F2D(); break; + case Constants.D2I : obj = new D2I(); break; + case Constants.D2L : obj = new D2L(); break; + case Constants.D2F : obj = new D2F(); break; + case Constants.I2B : obj = new I2B(); break; + case Constants.I2C : obj = new I2C(); break; + case Constants.I2S : obj = new I2S(); break; + case Constants.LCMP : obj = new LCMP(); break; + case Constants.FCMPL : obj = new FCMPL(); break; + case Constants.FCMPG : obj = new FCMPG(); break; + case Constants.DCMPL : obj = new DCMPL(); break; + case Constants.DCMPG : obj = new DCMPG(); break; + case Constants.IFEQ : obj = new IFEQ(); break; + case Constants.IFNE : obj = new IFNE(); break; + case Constants.IFLT : obj = new IFLT(); break; + case Constants.IFGE : obj = new IFGE(); break; + case Constants.IFGT : obj = new IFGT(); break; + case Constants.IFLE : obj = new IFLE(); break; + case Constants.IF_ICMPEQ: obj = new IF_ICMPEQ(); break; + case Constants.IF_ICMPNE: obj = new IF_ICMPNE(); break; + case Constants.IF_ICMPLT: obj = new IF_ICMPLT(); break; + case Constants.IF_ICMPGE: obj = new IF_ICMPGE(); break; + case Constants.IF_ICMPGT: obj = new IF_ICMPGT(); break; + case Constants.IF_ICMPLE: obj = new IF_ICMPLE(); break; + case Constants.IF_ACMPEQ: obj = new IF_ACMPEQ(); break; + case Constants.IF_ACMPNE : obj = new IF_ACMPNE(); break; + case Constants.GOTO : obj = new GOTO(); break; + case Constants.JSR : obj = new JSR(); break; + case Constants.RET : obj = new RET(); break; + case Constants.TABLESWITCH : obj = new TABLESWITCH(); break; + case Constants.LOOKUPSWITCH : obj = new LOOKUPSWITCH(); break; + case Constants.IRETURN : obj = new IRETURN(); break; + case Constants.LRETURN : obj = new LRETURN(); break; + case Constants.FRETURN : obj = new FRETURN(); break; + case Constants.DRETURN : obj = new DRETURN(); break; + case Constants.ARETURN : obj = new ARETURN(); break; + case Constants.RETURN : obj = new RETURN(); break; + case Constants.GETSTATIC : obj = new GETSTATIC(); break; + case Constants.PUTSTATIC : obj = new PUTSTATIC(); break; + case Constants.GETFIELD : obj = new GETFIELD(); break; + case Constants.PUTFIELD : obj = new PUTFIELD(); break; + case Constants.INVOKEVIRTUAL : obj = new INVOKEVIRTUAL(); break; + case Constants.INVOKESPECIAL : obj = new INVOKESPECIAL(); break; + case Constants.INVOKESTATIC : obj = new INVOKESTATIC(); break; + case Constants.INVOKEINTERFACE : obj = new INVOKEINTERFACE(); break; + case Constants.NEW : obj = new NEW(); break; + case Constants.NEWARRAY : obj = new NEWARRAY(); break; + case Constants.ANEWARRAY : obj = new ANEWARRAY(); break; + case Constants.ARRAYLENGTH : obj = new ARRAYLENGTH(); break; + case Constants.ATHROW : obj = new ATHROW(); break; + case Constants.CHECKCAST : obj = new CHECKCAST(); break; + case Constants.INSTANCEOF : obj = new INSTANCEOF(); break; + case Constants.MONITORENTER : obj = new MONITORENTER(); break; + case Constants.MONITOREXIT : obj = new MONITOREXIT(); break; + case Constants.MULTIANEWARRAY : obj = new MULTIANEWARRAY(); break; + case Constants.IFNULL : obj = new IFNULL(); break; + case Constants.IFNONNULL : obj = new IFNONNULL(); break; + case Constants.GOTO_W : obj = new GOTO_W(); break; + case Constants.JSR_W : obj = new JSR_W(); break; + default: + throw new ClassGenException("Illegal opcode detected"); + } + } catch (ClassGenException e) { + throw e; + } catch (Exception e) { + throw new ClassGenException(e.toString()); } - - try { - obj = (Instruction)clazz.newInstance(); - if(wide && !((obj instanceof LocalVariableInstruction) || (obj instanceof IINC) || (obj instanceof RET))) - throw new Exception("Illegal opcode after wide: " + opcode); + throw new ClassGenException("Illegal opcode after wide: " + opcode); obj.setOpcode(opcode); obj.initFromFile(bytes, wide); // Do further initializations, if any // Byte code offset set in InstructionList - } catch(Exception e) { throw new ClassGenException(e.toString()); } - return obj; } diff -N -a -u -r -b bcel-5.1/src/java/org/apache/bcel/generic/MethodGen.java bcel/src/java/org/apache/bcel/generic/MethodGen.java --- bcel-5.1/src/java/org/apache/bcel/generic/MethodGen.java 2003-04-25 09:06:16.000000000 -0700 +++ bcel/src/java/org/apache/bcel/generic/MethodGen.java 2004-01-29 04:39:47.265625000 -0800 @@ -133,9 +133,9 @@ /* Add local variables, namely the implicit `this' and the arguments */ - if(!isStatic() && (class_name != null)) { // Instance method -> `this' is local var 0 - addLocalVariable("this", new ObjectType(class_name), start, end); - } +// if(!isStatic() && (class_name != null)) { // Instance method -> `this' is local var 0 +// addLocalVariable("this", new ObjectType(class_name), start, end); +// } } if(arg_types != null) { @@ -152,17 +152,17 @@ throw new ClassGenException("Mismatch in argument array lengths: " + size + " vs. " + arg_names.length); } else { // Give them dummy names - arg_names = new String[size]; - - for(int i=0; i < size; i++) - arg_names[i] = "arg" + i; - - setArgumentNames(arg_names); +// arg_names = new String[size]; +// +// for(int i=0; i < size; i++) +// arg_names[i] = "arg" + i; +// +// setArgumentNames(arg_names); } if(!abstract_) { for(int i=0; i < size; i++) { - addLocalVariable(arg_names[i], arg_types[i], start, end); +// addLocalVariable(arg_names[i], arg_types[i], start, end); } } }