]> source.dussan.org Git - aspectj.git/commitdiff
refactoring
authoraclement <aclement>
Mon, 14 Sep 2009 20:29:10 +0000 (20:29 +0000)
committeraclement <aclement>
Mon, 14 Sep 2009 20:29:10 +0000 (20:29 +0000)
bcel-builder/src/org/aspectj/apache/bcel/Constants.java
bcel-builder/src/org/aspectj/apache/bcel/ExceptionConstants.java
bcel-builder/src/org/aspectj/apache/bcel/classfile/ConstantPool.java
bcel-builder/src/org/aspectj/apache/bcel/classfile/JavaClass.java
bcel-builder/src/org/aspectj/apache/bcel/classfile/Utility.java
bcel-builder/src/org/aspectj/apache/bcel/generic/FieldGen.java
bcel-builder/src/org/aspectj/apache/bcel/generic/FieldGenOrMethodGen.java
bcel-builder/src/org/aspectj/apache/bcel/generic/Instruction.java
bcel-builder/src/org/aspectj/apache/bcel/generic/InstructionCP.java
bcel-builder/src/org/aspectj/apache/bcel/generic/MethodGen.java
bcel-builder/verifier-src/org/aspectj/apache/bcel/verifier/util/BCELFactory.java

index 478ceca1141b487c5ed36fa286adf4b0cae9dfe0..de498b241c5f4e842385a6a0acadcdf204523c85 100644 (file)
@@ -59,7 +59,7 @@ import org.aspectj.apache.bcel.generic.Type;
 /**
  * Constants for the project, mostly defined in the JVM specification.
  * 
- * @version $Id: Constants.java,v 1.5 2008/08/27 23:58:58 aclement Exp $
+ * @version $Id: Constants.java,v 1.6 2009/09/14 20:29:10 aclement Exp $
  * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  */
 public interface Constants {
@@ -470,7 +470,7 @@ public interface Constants {
        public static final Type[] types = new Type[256];
        public static final long[] instFlags = new long[256];
 
-       public static final Class[][] instExcs = new Class[256][];
+       public static final Class<Throwable>[][] instExcs = new Class[256][];
 
        static final Clinit _unused = new Clinit();
 
@@ -696,8 +696,8 @@ public interface Constants {
                        instExcs[INSTANCEOF] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION;
                        instFlags[MULTIANEWARRAY] = CP_INST | LOADCLASS_INST | EXCEPTION_THROWER | INDEXED;
                        instExcs[MULTIANEWARRAY] = ExceptionConstants.EXCS_CLASS_AND_INTERFACE_RESOLUTION_ANEWARRAY; // fixme i think this is a
-                                                                                                                                                                                                                       // stackproducer, old
-                                                                                                                                                                                                                       // bcel says no...
+                       // stackproducer, old
+                       // bcel says no...
 
                        instFlags[GETFIELD] = EXCEPTION_THROWER | CP_INST | LOADCLASS_INST | INDEXED;
                        instExcs[GETFIELD] = ExceptionConstants.EXCS_FIELD_AND_METHOD_RESOLUTION_GETFIELD_PUTFIELD;
index 6b41f4d4a23bd7bc65f0e59284f0b6fbe8d1b4cd..34455be3596ee1a934586b43b1a2098d76e6336c 100644 (file)
@@ -56,104 +56,93 @@ package org.aspectj.apache.bcel;
 
 /**
  * Exception constants.
- *
- * @version $Id: ExceptionConstants.java,v 1.4 2009/09/09 19:56:20 aclement Exp $
- * @author  <A HREF="http://www.inf.fu-berlin.de/~ehaase">E. Haase</A>
+ * 
+ * @version $Id: ExceptionConstants.java,v 1.5 2009/09/14 20:29:10 aclement Exp $
+ * @author <A HREF="http://www.inf.fu-berlin.de/~ehaase">E. Haase</A>
  */
 public interface ExceptionConstants {
-  /** The mother of all exceptions
-   */
-  public static final Class<Throwable> THROWABLE = Throwable.class;
-
-  /** Super class of any run-time exception
-   */
-  public static final Class<RuntimeException> RUNTIME_EXCEPTION = RuntimeException.class;
-
-  /** Super class of any linking exception (aka Linkage Error)
-   */
-  public static final Class<LinkageError> LINKING_EXCEPTION = LinkageError.class;
-
-  /** Linking Exceptions
-   */
-  public static final Class<ClassCircularityError> CLASS_CIRCULARITY_ERROR         = ClassCircularityError.class;
-  public static final Class<ClassFormatError> CLASS_FORMAT_ERROR                   = ClassFormatError.class;
-  public static final Class<ExceptionInInitializerError> EXCEPTION_IN_INITIALIZER_ERROR  = ExceptionInInitializerError.class;
-  public static final Class<IncompatibleClassChangeError> INCOMPATIBLE_CLASS_CHANGE_ERROR = IncompatibleClassChangeError.class;
-  public static final Class<AbstractMethodError> ABSTRACT_METHOD_ERROR           = AbstractMethodError.class;
-  public static final Class ILLEGAL_ACCESS_ERROR            = IllegalAccessError.class;
-  public static final Class<InstantiationError> INSTANTIATION_ERROR             = InstantiationError.class;
-  public static final Class<NoSuchFieldError> NO_SUCH_FIELD_ERROR             = NoSuchFieldError.class;
-  public static final Class<NoSuchMethodError> NO_SUCH_METHOD_ERROR            = NoSuchMethodError.class;
-  public static final Class<NoClassDefFoundError> NO_CLASS_DEF_FOUND_ERROR        = NoClassDefFoundError.class;
-  public static final Class<UnsatisfiedLinkError> UNSATISFIED_LINK_ERROR          = UnsatisfiedLinkError.class;
-  public static final Class<VerifyError> VERIFY_ERROR                    = VerifyError.class;
-
-  /* UnsupportedClassVersionError is new in JDK 1.2 */
-  //public static final Class UnsupportedClassVersionError = UnsupportedClassVersionError.class;
-
-  /** Run-Time Exceptions 
-   */
-  public static final Class<NullPointerException> NULL_POINTER_EXCEPTION              = NullPointerException.class;
-  public static final Class<ArrayIndexOutOfBoundsException> ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION = ArrayIndexOutOfBoundsException.class;
-  public static final Class<ArithmeticException> ARITHMETIC_EXCEPTION                = ArithmeticException.class;
-  public static final Class NEGATIVE_ARRAY_SIZE_EXCEPTION       = NegativeArraySizeException.class;
-  public static final Class<ClassCastException> CLASS_CAST_EXCEPTION                = ClassCastException.class;
-  public static final Class<IllegalMonitorStateException> ILLEGAL_MONITOR_STATE               = IllegalMonitorStateException.class;
-
-  /** Pre-defined exception arrays according to chapters 5.1-5.4 of the Java Virtual
-   * Machine Specification 
-   */
-  public static final Class[] EXCS_CLASS_AND_INTERFACE_RESOLUTION = {
-    NO_CLASS_DEF_FOUND_ERROR, CLASS_FORMAT_ERROR, VERIFY_ERROR,        ABSTRACT_METHOD_ERROR,
-    EXCEPTION_IN_INITIALIZER_ERROR, ILLEGAL_ACCESS_ERROR
-  }; // Chapter 5.1
-  public static final Class[] EXCS_CLASS_AND_INTERFACE_RESOLUTION_MULTIANEWARRAY = {
-           NO_CLASS_DEF_FOUND_ERROR, CLASS_FORMAT_ERROR, VERIFY_ERROR, ABSTRACT_METHOD_ERROR,
-           EXCEPTION_IN_INITIALIZER_ERROR, ILLEGAL_ACCESS_ERROR,NEGATIVE_ARRAY_SIZE_EXCEPTION,ILLEGAL_ACCESS_ERROR
-         };
-  public static final Class[] EXCS_CLASS_AND_INTERFACE_RESOLUTION_ANEWARRAY = {
-           NO_CLASS_DEF_FOUND_ERROR, CLASS_FORMAT_ERROR, VERIFY_ERROR, ABSTRACT_METHOD_ERROR,
-           EXCEPTION_IN_INITIALIZER_ERROR, ILLEGAL_ACCESS_ERROR,NEGATIVE_ARRAY_SIZE_EXCEPTION
-  }; // Chapter 5.1
-  public static final Class[] EXCS_CLASS_AND_INTERFACE_RESOLUTION_CHECKCAST = {
-           NO_CLASS_DEF_FOUND_ERROR, CLASS_FORMAT_ERROR, VERIFY_ERROR, ABSTRACT_METHOD_ERROR,
-           EXCEPTION_IN_INITIALIZER_ERROR, ILLEGAL_ACCESS_ERROR,CLASS_CAST_EXCEPTION
-  }; // Chapter 5.1
-  public static final Class[] EXCS_CLASS_AND_INTERFACE_RESOLUTION_FOR_ALLOCATIONS= {
-           NO_CLASS_DEF_FOUND_ERROR, CLASS_FORMAT_ERROR, VERIFY_ERROR, ABSTRACT_METHOD_ERROR,
-           EXCEPTION_IN_INITIALIZER_ERROR, ILLEGAL_ACCESS_ERROR, INSTANTIATION_ERROR,ILLEGAL_ACCESS_ERROR
-         };
-
-  public static final Class[] EXCS_FIELD_AND_METHOD_RESOLUTION = {
-    NO_SUCH_FIELD_ERROR, ILLEGAL_ACCESS_ERROR, NO_SUCH_METHOD_ERROR
-  }; // Chapter 5.2
-
-  public static final Class[] EXCS_FIELD_AND_METHOD_RESOLUTION_GETFIELD_PUTFIELD = {
-    NO_SUCH_FIELD_ERROR, ILLEGAL_ACCESS_ERROR, NO_SUCH_METHOD_ERROR,INCOMPATIBLE_CLASS_CHANGE_ERROR,NULL_POINTER_EXCEPTION
-  }; 
-  
-  public static final Class[] EXCS_FIELD_AND_METHOD_RESOLUTION_GETSTATIC_PUTSTATIC = {
-           NO_SUCH_FIELD_ERROR, ILLEGAL_ACCESS_ERROR, NO_SUCH_METHOD_ERROR,INCOMPATIBLE_CLASS_CHANGE_ERROR
-  };
-
-  public static final Class[] EXCS_INTERFACE_METHOD_RESOLUTION_INVOKEINTERFACE = {
-         INCOMPATIBLE_CLASS_CHANGE_ERROR,ILLEGAL_ACCESS_ERROR,ABSTRACT_METHOD_ERROR,UNSATISFIED_LINK_ERROR
-  };
-  public static final Class[] EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESPECIAL_INVOKEVIRTUAL = {
-         INCOMPATIBLE_CLASS_CHANGE_ERROR,NULL_POINTER_EXCEPTION,ABSTRACT_METHOD_ERROR,UNSATISFIED_LINK_ERROR
-  };
-
-  public static final Class[] EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESTATIC = {
-         INCOMPATIBLE_CLASS_CHANGE_ERROR,UNSATISFIED_LINK_ERROR
-  };
-
-
-  public static final Class[] EXCS_INTERFACE_METHOD_RESOLUTION = new Class[0]; // Chapter 5.3 (as below)
-  public static final Class[] EXCS_STRING_RESOLUTION           = new Class[0];
-  // Chapter 5.4 (no errors but the ones that _always_ could happen! How stupid.)
-
-  public static final Class[] EXCS_ARRAY_EXCEPTION = {
-    NULL_POINTER_EXCEPTION, ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION
-  };
+       /**
+        * The mother of all exceptions
+        */
+       public static final Class<Throwable> THROWABLE = Throwable.class;
+
+       /**
+        * Super class of any run-time exception
+        */
+       public static final Class<RuntimeException> RUNTIME_EXCEPTION = RuntimeException.class;
+
+       /**
+        * Super class of any linking exception (aka Linkage Error)
+        */
+       public static final Class<LinkageError> LINKING_EXCEPTION = LinkageError.class;
+
+       /**
+        * Linking Exceptions
+        */
+       public static final Class<ClassCircularityError> CLASS_CIRCULARITY_ERROR = ClassCircularityError.class;
+       public static final Class<ClassFormatError> CLASS_FORMAT_ERROR = ClassFormatError.class;
+       public static final Class<ExceptionInInitializerError> EXCEPTION_IN_INITIALIZER_ERROR = ExceptionInInitializerError.class;
+       public static final Class<IncompatibleClassChangeError> INCOMPATIBLE_CLASS_CHANGE_ERROR = IncompatibleClassChangeError.class;
+       public static final Class<AbstractMethodError> ABSTRACT_METHOD_ERROR = AbstractMethodError.class;
+       public static final Class ILLEGAL_ACCESS_ERROR = IllegalAccessError.class;
+       public static final Class<InstantiationError> INSTANTIATION_ERROR = InstantiationError.class;
+       public static final Class<NoSuchFieldError> NO_SUCH_FIELD_ERROR = NoSuchFieldError.class;
+       public static final Class<NoSuchMethodError> NO_SUCH_METHOD_ERROR = NoSuchMethodError.class;
+       public static final Class<NoClassDefFoundError> NO_CLASS_DEF_FOUND_ERROR = NoClassDefFoundError.class;
+       public static final Class<UnsatisfiedLinkError> UNSATISFIED_LINK_ERROR = UnsatisfiedLinkError.class;
+       public static final Class<VerifyError> VERIFY_ERROR = VerifyError.class;
+
+       /* UnsupportedClassVersionError is new in JDK 1.2 */
+       // public static final Class UnsupportedClassVersionError = UnsupportedClassVersionError.class;
+       /**
+        * Run-Time Exceptions
+        */
+       public static final Class<NullPointerException> NULL_POINTER_EXCEPTION = NullPointerException.class;
+       public static final Class<ArrayIndexOutOfBoundsException> ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION = ArrayIndexOutOfBoundsException.class;
+       public static final Class<ArithmeticException> ARITHMETIC_EXCEPTION = ArithmeticException.class;
+       public static final Class NEGATIVE_ARRAY_SIZE_EXCEPTION = NegativeArraySizeException.class;
+       public static final Class<ClassCastException> CLASS_CAST_EXCEPTION = ClassCastException.class;
+       public static final Class<IllegalMonitorStateException> ILLEGAL_MONITOR_STATE = IllegalMonitorStateException.class;
+
+       /**
+        * Pre-defined exception arrays according to chapters 5.1-5.4 of the Java Virtual Machine Specification
+        */
+       public static final Class[] EXCS_CLASS_AND_INTERFACE_RESOLUTION = { NO_CLASS_DEF_FOUND_ERROR, CLASS_FORMAT_ERROR, VERIFY_ERROR,
+                       ABSTRACT_METHOD_ERROR, EXCEPTION_IN_INITIALIZER_ERROR, ILLEGAL_ACCESS_ERROR }; // Chapter 5.1
+       public static final Class[] EXCS_CLASS_AND_INTERFACE_RESOLUTION_MULTIANEWARRAY = { NO_CLASS_DEF_FOUND_ERROR,
+                       CLASS_FORMAT_ERROR, VERIFY_ERROR, ABSTRACT_METHOD_ERROR, EXCEPTION_IN_INITIALIZER_ERROR, ILLEGAL_ACCESS_ERROR,
+                       NEGATIVE_ARRAY_SIZE_EXCEPTION, ILLEGAL_ACCESS_ERROR };
+       public static final Class[] EXCS_CLASS_AND_INTERFACE_RESOLUTION_ANEWARRAY = { NO_CLASS_DEF_FOUND_ERROR, CLASS_FORMAT_ERROR,
+                       VERIFY_ERROR, ABSTRACT_METHOD_ERROR, EXCEPTION_IN_INITIALIZER_ERROR, ILLEGAL_ACCESS_ERROR,
+                       NEGATIVE_ARRAY_SIZE_EXCEPTION }; // Chapter 5.1
+       public static final Class[] EXCS_CLASS_AND_INTERFACE_RESOLUTION_CHECKCAST = { NO_CLASS_DEF_FOUND_ERROR, CLASS_FORMAT_ERROR,
+                       VERIFY_ERROR, ABSTRACT_METHOD_ERROR, EXCEPTION_IN_INITIALIZER_ERROR, ILLEGAL_ACCESS_ERROR, CLASS_CAST_EXCEPTION }; // Chapter
+       // 5.1
+       public static final Class[] EXCS_CLASS_AND_INTERFACE_RESOLUTION_FOR_ALLOCATIONS = { NO_CLASS_DEF_FOUND_ERROR,
+                       CLASS_FORMAT_ERROR, VERIFY_ERROR, ABSTRACT_METHOD_ERROR, EXCEPTION_IN_INITIALIZER_ERROR, ILLEGAL_ACCESS_ERROR,
+                       INSTANTIATION_ERROR, ILLEGAL_ACCESS_ERROR };
+
+       public static final Class[] EXCS_FIELD_AND_METHOD_RESOLUTION = { NO_SUCH_FIELD_ERROR, ILLEGAL_ACCESS_ERROR,
+                       NO_SUCH_METHOD_ERROR }; // Chapter 5.2
+
+       public static final Class[] EXCS_FIELD_AND_METHOD_RESOLUTION_GETFIELD_PUTFIELD = { NO_SUCH_FIELD_ERROR, ILLEGAL_ACCESS_ERROR,
+                       NO_SUCH_METHOD_ERROR, INCOMPATIBLE_CLASS_CHANGE_ERROR, NULL_POINTER_EXCEPTION };
+
+       public static final Class[] EXCS_FIELD_AND_METHOD_RESOLUTION_GETSTATIC_PUTSTATIC = { NO_SUCH_FIELD_ERROR, ILLEGAL_ACCESS_ERROR,
+                       NO_SUCH_METHOD_ERROR, INCOMPATIBLE_CLASS_CHANGE_ERROR };
+
+       public static final Class[] EXCS_INTERFACE_METHOD_RESOLUTION_INVOKEINTERFACE = { INCOMPATIBLE_CLASS_CHANGE_ERROR,
+                       ILLEGAL_ACCESS_ERROR, ABSTRACT_METHOD_ERROR, UNSATISFIED_LINK_ERROR };
+       public static final Class[] EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESPECIAL_INVOKEVIRTUAL = { INCOMPATIBLE_CLASS_CHANGE_ERROR,
+                       NULL_POINTER_EXCEPTION, ABSTRACT_METHOD_ERROR, UNSATISFIED_LINK_ERROR };
+
+       public static final Class[] EXCS_INTERFACE_METHOD_RESOLUTION_INVOKESTATIC = { INCOMPATIBLE_CLASS_CHANGE_ERROR,
+                       UNSATISFIED_LINK_ERROR };
+
+       public static final Class[] EXCS_INTERFACE_METHOD_RESOLUTION = new Class[0]; // Chapter 5.3 (as below)
+       public static final Class[] EXCS_STRING_RESOLUTION = new Class[0];
+       // Chapter 5.4 (no errors but the ones that _always_ could happen! How stupid.)
+
+       public static final Class[] EXCS_ARRAY_EXCEPTION = { NULL_POINTER_EXCEPTION, ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION };
 
 }
index dece36ee42382967db5629a4d8020f8c2f108c9d..6a68adc2f58add9db2297add2b9967adf979a540 100644 (file)
@@ -197,6 +197,10 @@ public class ConstantPool implements Node {
                return constantToString(c);
        }
 
+       public String constantToString(int index) {
+               return constantToString(getConstant(index));
+       }
+
        public void accept(ClassVisitor v) {
                v.visitConstantPool(this);
        }
index 1a1ef3c0055e28bea9781acc5c891a2c801436aa..f3f6b70b3e0d197f3f8323a185b55972cf7c0d29 100644 (file)
@@ -80,7 +80,7 @@ import org.aspectj.apache.bcel.util.SyntheticRepository;
  * The intent of this class is to represent a parsed or otherwise existing class file. Those interested in programatically
  * generating classes should see the <a href="../generic/ClassGen.html">ClassGen</a> class.
  * 
- * @version $Id: JavaClass.java,v 1.18 2009/09/10 03:59:33 aclement Exp $
+ * @version $Id: JavaClass.java,v 1.19 2009/09/14 20:29:10 aclement Exp $
  * @see org.aspectj.apache.bcel.generic.ClassGen
  * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  */
@@ -387,7 +387,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
                return null;
        }
 
-       public Method getMethod(java.lang.reflect.Constructor c) {
+       public Method getMethod(java.lang.reflect.Constructor<?> c) {
                for (int i = 0; i < methods.length; i++) {
                        Method method = methods[i];
                        if (method.getName().equals("<init>") && c.getModifiers() == method.getModifiers()
index 66a0635f462a9280450979e4794b998916839adb..df6b7f37652272eb84dc5677325d69ebcaf9e269 100644 (file)
@@ -59,7 +59,6 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
 import java.util.List;
 
 import org.aspectj.apache.bcel.Constants;
@@ -76,7 +75,7 @@ import org.aspectj.apache.bcel.util.ByteSequence;
 /**
  * Utility functions that do not really belong to any class in particular.
  * 
- * @version $Id: Utility.java,v 1.10 2009/09/10 03:59:33 aclement Exp $
+ * @version $Id: Utility.java,v 1.11 2009/09/14 20:29:10 aclement Exp $
  * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  * 
  *         modified: Andy Clement 2-mar-05 Removed unnecessary static and optimized
@@ -615,10 +614,7 @@ public abstract class Utility {
         * RuntimeInvisibleParameterAnnotations
         */
        // OPTIMIZE looks heavyweight?
-       public static Attribute[] getParameterAnnotationAttributes(ConstantPool cp, List[] /*
-                                                                                                                                                                                * Array of lists, array size depends on
-                                                                                                                                                                                * #params
-                                                                                                                                                                                */vec) {
+       public static Attribute[] getParameterAnnotationAttributes(ConstantPool cp, List<AnnotationGen>[] vec) {
 
                int visCount[] = new int[vec.length];
                int totalVisCount = 0;
@@ -627,10 +623,9 @@ public abstract class Utility {
                try {
 
                        for (int i = 0; i < vec.length; i++) {
-                               List l = vec[i];
+                               List<AnnotationGen> l = vec[i];
                                if (l != null) {
-                                       for (Iterator iter = l.iterator(); iter.hasNext();) {
-                                               AnnotationGen element = (AnnotationGen) iter.next();
+                                       for (AnnotationGen element : l) {
                                                if (element.isRuntimeVisible()) {
                                                        visCount[i]++;
                                                        totalVisCount++;
@@ -650,9 +645,8 @@ public abstract class Utility {
                        for (int i = 0; i < vec.length; i++) {
                                rvaDos.writeShort(visCount[i]);
                                if (visCount[i] > 0) {
-                                       List l = vec[i];
-                                       for (Iterator iter = l.iterator(); iter.hasNext();) {
-                                               AnnotationGen element = (AnnotationGen) iter.next();
+                                       List<AnnotationGen> l = vec[i];
+                                       for (AnnotationGen element : l) {
                                                if (element.isRuntimeVisible())
                                                        element.dump(rvaDos);
                                        }
@@ -668,9 +662,8 @@ public abstract class Utility {
                        for (int i = 0; i < vec.length; i++) {
                                riaDos.writeShort(invisCount[i]);
                                if (invisCount[i] > 0) {
-                                       List l = vec[i];
-                                       for (Iterator iter = l.iterator(); iter.hasNext();) {
-                                               AnnotationGen element = (AnnotationGen) iter.next();
+                                       List<AnnotationGen> l = vec[i];
+                                       for (AnnotationGen element : l) {
                                                if (!element.isRuntimeVisible())
                                                        element.dump(riaDos);
                                        }
@@ -963,8 +956,7 @@ public abstract class Utility {
                        buf.append("\t");
                case Constants.INSTANCEOF:
                        index = bytes.readUnsignedShort();
-                       buf.append("\t<" + constant_pool.constantToString(index, Constants.CONSTANT_Class) + ">"
-                                       + (verbose ? " (" + index + ")" : ""));
+                       buf.append("\t<" + constant_pool.constantToString(index) + ">" + (verbose ? " (" + index + ")" : ""));
                        break;
 
                // Operands are references to methods in constant pool
@@ -972,15 +964,14 @@ public abstract class Utility {
                case Constants.INVOKESTATIC:
                case Constants.INVOKEVIRTUAL:
                        index = bytes.readUnsignedShort();
-                       buf.append("\t" + constant_pool.constantToString(index, Constants.CONSTANT_Methodref)
-                                       + (verbose ? " (" + index + ")" : ""));
+                       buf.append("\t" + constant_pool.constantToString(index) + (verbose ? " (" + index + ")" : ""));
                        break;
 
                case Constants.INVOKEINTERFACE:
                        index = bytes.readUnsignedShort();
                        int nargs = bytes.readUnsignedByte(); // historical, redundant
-                       buf.append("\t" + constant_pool.constantToString(index, Constants.CONSTANT_InterfaceMethodref)
-                                       + (verbose ? " (" + index + ")\t" : "") + nargs + "\t" + bytes.readUnsignedByte()); // Last byte is a reserved
+                       buf.append("\t" + constant_pool.constantToString(index) + (verbose ? " (" + index + ")\t" : "") + nargs + "\t"
+                                       + bytes.readUnsignedByte()); // Last byte is a reserved
                        // space
                        break;
 
@@ -988,14 +979,12 @@ public abstract class Utility {
                case Constants.LDC_W:
                case Constants.LDC2_W:
                        index = bytes.readUnsignedShort();
-                       buf.append("\t\t" + constant_pool.constantToString(index, constant_pool.getConstant(index).getTag())
-                                       + (verbose ? " (" + index + ")" : ""));
+                       buf.append("\t\t" + constant_pool.constantToString(index) + (verbose ? " (" + index + ")" : ""));
                        break;
 
                case Constants.LDC:
                        index = bytes.readUnsignedByte();
-                       buf.append("\t\t" + constant_pool.constantToString(index, constant_pool.getConstant(index).getTag())
-                                       + (verbose ? " (" + index + ")" : ""));
+                       buf.append("\t\t" + constant_pool.constantToString(index) + (verbose ? " (" + index + ")" : ""));
                        break;
 
                // Array of references
index 07f276b1205588a6183c15b789c46dedb7731e4c..2208446330899551add0e64291a232f9db596413 100644 (file)
@@ -72,7 +72,7 @@ import org.aspectj.apache.bcel.classfile.annotation.RuntimeAnnotations;
  * Template class for building up a field. The only extraordinary thing one can do is to add a constant value attribute to a field
  * (which must of course be compatible with the declared type).
  * 
- * @version $Id: FieldGen.java,v 1.7 2009/09/09 21:26:54 aclement Exp $
+ * @version $Id: FieldGen.java,v 1.8 2009/09/14 20:29:10 aclement Exp $
  * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  * @see Field
  */
@@ -148,8 +148,8 @@ public class FieldGen extends FieldGenOrMethodGen {
         */
        public Field getField() {
                String signature = getSignature();
-               int name_index = cp.addUtf8(name);
-               int signature_index = cp.addUtf8(signature);
+               int nameIndex = cp.addUtf8(name);
+               int signatureIndex = cp.addUtf8(signature);
 
                if (value != null) {
                        checkType(type);
@@ -159,7 +159,7 @@ public class FieldGen extends FieldGenOrMethodGen {
 
                addAnnotationsAsAttribute(cp);
 
-               return new Field(modifiers, name_index, signature_index, getAttributesImmutable(), cp);
+               return new Field(modifiers, nameIndex, signatureIndex, getAttributesImmutable(), cp);
        }
 
        private int addConstant() {
@@ -194,44 +194,27 @@ public class FieldGen extends FieldGenOrMethodGen {
        }
 
        public String getInitialValue() {
-               if (value != null) {
-                       return value.toString();
-               } else
-                       return null;
+               return (value == null ? null : value.toString());
        }
 
        /**
         * Return string representation close to declaration format, `public static final short MAX = 100', e.g..
-        * 
-        * @return String representation of field
         */
        @Override
        public final String toString() {
-               String name, signature, access; // Short cuts to constant pool
-
-               access = Utility.accessToString(modifiers);
+               String access = Utility.accessToString(modifiers);
                access = access.equals("") ? "" : (access + " ");
-               signature = type.toString();
-               name = getName();
+               String signature = type.toString();
+               String name = getName();
 
-               StringBuffer buf = new StringBuffer(access + signature + " " + name);
+               StringBuffer buf = new StringBuffer(access).append(signature).append(" ").append(name);
                String value = getInitialValue();
 
-               if (value != null)
-                       buf.append(" = " + value);
-
+               if (value != null) {
+                       buf.append(" = ").append(value);
+               }
                // TODO: Add attributes and annotations to the string
-
                return buf.toString();
        }
 
-       /**
-        * @return deep copy of this field
-        */
-       public FieldGen copy(ConstantPool cp) {
-               FieldGen fg = (FieldGen) clone();
-
-               fg.setConstantPool(cp);
-               return fg;
-       }
 }
index 372c7b7b99bf745b07fe011a5936bb1523b79d5e..74ede06ec9f602cf1d79ae7dd5ba3f2801886612 100644 (file)
@@ -68,16 +68,16 @@ import org.aspectj.apache.bcel.classfile.annotation.RuntimeAnnotations;
 /**
  * Super class for FieldGen and MethodGen objects, since they have some methods in common!
  * 
- * @version $Id: FieldGenOrMethodGen.java,v 1.6 2009/09/09 22:18:20 aclement Exp $
+ * @version $Id: FieldGenOrMethodGen.java,v 1.7 2009/09/14 20:29:10 aclement Exp $
  * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  */
-public abstract class FieldGenOrMethodGen extends Modifiers implements Cloneable {
+public abstract class FieldGenOrMethodGen extends Modifiers {
 
        protected String name;
        protected Type type;
        protected ConstantPool cp;
-       private ArrayList/* <Attribute> */<Attribute> attributeList = new ArrayList<Attribute>();
-       private ArrayList<AnnotationGen> annotationList = new ArrayList<AnnotationGen>();
+       private ArrayList<Attribute> attributeList = new ArrayList<Attribute>();
+       protected ArrayList<AnnotationGen> annotationList = new ArrayList<AnnotationGen>();
 
        protected FieldGenOrMethodGen() {
        }
@@ -118,6 +118,10 @@ public abstract class FieldGenOrMethodGen extends Modifiers implements Cloneable
                attributeList.clear();
        }
 
+       public List<AnnotationGen> getAnnotations() {
+               return annotationList;
+       }
+
        public void addAnnotation(AnnotationGen ag) {
                annotationList.add(ag);
        }
@@ -130,7 +134,7 @@ public abstract class FieldGenOrMethodGen extends Modifiers implements Cloneable
                annotationList.clear();
        }
 
-       public List/* <Attribute> */<Attribute> getAttributes() {
+       public List<Attribute> getAttributes() {
                return attributeList;
        }
 
@@ -149,22 +153,6 @@ public abstract class FieldGenOrMethodGen extends Modifiers implements Cloneable
                }
        }
 
-       public AnnotationGen[] getAnnotations() {
-               AnnotationGen[] annotations = new AnnotationGen[annotationList.size()];
-               annotationList.toArray(annotations);
-               return annotations;
-       }
-
        public abstract String getSignature();
 
-       // OPTIMIZE clone any use???
-       @Override
-       public Object clone() {
-               try {
-                       return super.clone();
-               } catch (CloneNotSupportedException e) {
-                       System.err.println(e);
-                       return null;
-               }
-       }
 }
index 3f7cadc9ad3f549dcc7078789e7441e3c18d2f2b..ae85e06a0109ca9aac6c2ef70658b2c172c42c81 100644 (file)
@@ -67,15 +67,12 @@ import com.sun.org.apache.bcel.internal.generic.BranchInstruction;
 /**
  * Abstract super class for all Java byte codes.
  * 
- * @version $Id: Instruction.java,v 1.7 2008/08/28 00:06:23 aclement Exp $
+ * @version $Id: Instruction.java,v 1.8 2009/09/14 20:29:10 aclement Exp $
  * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  */
 public class Instruction implements Cloneable, Serializable, Constants {
        public short opcode = -1;
 
-       private Instruction() {
-       }
-
        public Instruction(short opcode) {
                this.opcode = opcode;
        }
@@ -270,6 +267,7 @@ public class Instruction implements Cloneable, Serializable, Constants {
        void dispose() {
        }
 
+       @Override
        public boolean equals(Object that) {
                if (!(that instanceof Instruction)) {
                        return false;
@@ -291,6 +289,7 @@ public class Instruction implements Cloneable, Serializable, Constants {
                return false;
        }
 
+       @Override
        public int hashCode() {
                int result = 17 + opcode * 37;
                if (isConstantInstruction()) {
@@ -362,19 +361,10 @@ public class Instruction implements Cloneable, Serializable, Constants {
                return false;
        }
 
-       public java.lang.Class[] getExceptions() {
-               // fixme
-               return Constants.instExcs[opcode];
-       }
-
        public boolean containsTarget(InstructionHandle ih) {
                throw new IllegalStateException("Dont ask!!");
        }
 
-       public void updateTarget(InstructionHandle old_ih, InstructionHandle new_ih) {
-               throw new IllegalStateException("Dont ask!!");
-       }
-
        public boolean isJsrInstruction() {
                return (Constants.instFlags[opcode] & JSR_INSTRUCTION) != 0;
        }
@@ -389,12 +379,10 @@ public class Instruction implements Cloneable, Serializable, Constants {
 
        public boolean isStackProducer() {
                return Constants.stackEntriesProduced[opcode] != 0;
-               // return ((Constants.instFlags[opcode]&STACK_PRODUCER)!=0);
        }
 
        public boolean isStackConsumer() {
                return Constants.CONSUME_STACK[opcode] != 0;
-               // return ((Constants.instFlags[opcode]&STACK_CONSUMER)!=0);
        }
 
        public boolean isIndexedInstruction() {
@@ -442,6 +430,7 @@ public class Instruction implements Cloneable, Serializable, Constants {
                }
        }
 
+       @Override
        public String toString() {
                return toString(true);
        }
index d84f5246ad01af29299dd96adf3496d2aa5fa005..e2b4f9c683a9dedd65346f9fda643af17d527fa8 100644 (file)
@@ -73,7 +73,7 @@ import com.sun.org.apache.bcel.internal.generic.LDC;
  * @see LDC
  * @see INVOKEVIRTUAL
  * 
- * @version $Id: InstructionCP.java,v 1.4 2009/09/10 15:35:06 aclement Exp $
+ * @version $Id: InstructionCP.java,v 1.5 2009/09/14 20:29:10 aclement Exp $
  * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  */
 public class InstructionCP extends Instruction {
@@ -212,8 +212,4 @@ public class InstructionCP extends Instruction {
                }
        }
 
-       @Override
-       public Class[] getExceptions() {
-               return org.aspectj.apache.bcel.ExceptionConstants.EXCS_STRING_RESOLUTION;
-       }
 }
index 67dfb11a5bc170bdf67fe9063d4f3305167ed95e..b85bf0165e55bfe86dad3fb0a6d874d078649d8d 100644 (file)
@@ -84,7 +84,7 @@ import org.aspectj.apache.bcel.classfile.annotation.RuntimeParameterAnnotations;
  * While generating code it may be necessary to insert NOP operations. You can use the `removeNOPs' method to get rid off them. The
  * resulting method object can be obtained via the `getMethod()' method.
  * 
- * @version $Id: MethodGen.java,v 1.13 2009/09/10 03:59:34 aclement Exp $
+ * @version $Id: MethodGen.java,v 1.14 2009/09/14 20:29:10 aclement Exp $
  * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  * @author <A HREF="http://www.vmeng.com/beard">Patrick C. Beard</A> [setMaxStack()]
  * @see InstructionList
@@ -106,9 +106,9 @@ public class MethodGen extends FieldGenOrMethodGen {
        private ArrayList<LocalVariableGen> localVariablesList = new ArrayList<LocalVariableGen>();
        private ArrayList<LineNumberGen> lineNumbersList = new ArrayList<LineNumberGen>();
        private ArrayList<CodeExceptionGen> exceptionsList = new ArrayList<CodeExceptionGen>();
-       private ArrayList<String> throws_vec = new ArrayList<String>();
+       private ArrayList<String> exceptionsThrown = new ArrayList<String>();
        private ArrayList<Attribute> codeAttributesList = new ArrayList<Attribute>();
-       private List[] param_annotations; // Array of lists containing AnnotationGen objects
+       private List<AnnotationGen>[] param_annotations; // Array of lists containing AnnotationGen objects
        private boolean hasParameterAnnotations = false;
        private boolean haveUnpackedParameterAnnotations = false;
 
@@ -216,25 +216,24 @@ public class MethodGen extends FieldGenOrMethodGen {
                        Attribute a = attributes[i];
 
                        if (a instanceof Code) {
-                               Code c = (Code) a;
-                               setMaxStack(c.getMaxStack());
-                               setMaxLocals(c.getMaxLocals());
+                               Code code = (Code) a;
+                               setMaxStack(code.getMaxStack());
+                               setMaxLocals(code.getMaxLocals());
 
-                               CodeException[] ces = c.getExceptionTable();
+                               CodeException[] ces = code.getExceptionTable();
 
                                InstructionHandle[] arrayOfInstructions = il.getInstructionsAsArray();
 
                                // process the exception table
                                // -
                                if (ces != null) {
-                                       for (int j = 0; j < ces.length; j++) {
-                                               CodeException ce = ces[j];
+                                       for (CodeException ce : ces) {
                                                int type = ce.getCatchType();
-                                               ObjectType c_type = null;
+                                               ObjectType catchType = null;
 
                                                if (type > 0) {
                                                        String cen = m.getConstantPool().getConstantString_CONSTANTClass(type);
-                                                       c_type = new ObjectType(cen);
+                                                       catchType = new ObjectType(cen);
                                                }
 
                                                int end_pc = ce.getEndPC();
@@ -250,11 +249,11 @@ public class MethodGen extends FieldGenOrMethodGen {
                                                }
 
                                                addExceptionHandler(il.findHandle(ce.getStartPC(), arrayOfInstructions), end, il.findHandle(ce
-                                                               .getHandlerPC(), arrayOfInstructions), c_type);
+                                                               .getHandlerPC(), arrayOfInstructions), catchType);
                                        }
                                }
 
-                               Attribute[] codeAttrs = c.getAttributes();
+                               Attribute[] codeAttrs = code.getAttributes();
                                for (int j = 0; j < codeAttrs.length; j++) {
                                        a = codeAttrs[j];
 
@@ -333,45 +332,30 @@ public class MethodGen extends FieldGenOrMethodGen {
                        } else if (a instanceof RuntimeAnnotations) {
                                RuntimeAnnotations runtimeAnnotations = (RuntimeAnnotations) a;
                                List<AnnotationGen> l = runtimeAnnotations.getAnnotations();
-                               for (Iterator<AnnotationGen> it = l.iterator(); it.hasNext();) {
-                                       AnnotationGen element = it.next();
-                                       addAnnotation(new AnnotationGen(element, cp, false));
-                               }
+                               annotationList.addAll(l);
+                               // for (Iterator<AnnotationGen> it = l.iterator(); it.hasNext();) {
+                               // AnnotationGen element = it.next();
+                               // addAnnotation(new AnnotationGen(element, cp, false));
+                               // }
                        } else {
                                addAttribute(a);
                        }
                }
        }
 
-       /**
-        * Adds a local variable to this method.
-        * 
-        * @param name variable name
-        * @param type variable type
-        * @param slot the index of the local variable, if type is long or double, the next available index is slot+2
-        * @param start from where the variable is valid
-        * @param end until where the variable is valid
-        * @return new local variable object
-        * @see LocalVariable
-        */
        public LocalVariableGen addLocalVariable(String name, Type type, int slot, InstructionHandle start, InstructionHandle end) {
-               // byte t = type.getType();
-               // if (t != Constants.T_ADDRESS) {
                int size = type.getSize();
-               if (slot + size > maxLocals)
+               if (slot + size > maxLocals) {
                        maxLocals = slot + size;
+               }
                LocalVariableGen l = new LocalVariableGen(slot, name, type, start, end);
                int i = localVariablesList.indexOf(l);
-               if (i >= 0)
+               if (i >= 0) {
                        localVariablesList.set(i, l); // Overwrite if necessary
-               else
+               } else {
                        localVariablesList.add(l);
+               }
                return l;
-               // } else {
-               // throw new IllegalArgumentException("Can not use " + type +
-               // " as type for local variable");
-               //                                       
-               // }
        }
 
        /**
@@ -587,29 +571,29 @@ public class MethodGen extends FieldGenOrMethodGen {
         * @param class_name (fully qualified) name of exception
         */
        public void addException(String class_name) {
-               throws_vec.add(class_name);
+               exceptionsThrown.add(class_name);
        }
 
        /**
         * Remove an exception.
         */
        public void removeException(String c) {
-               throws_vec.remove(c);
+               exceptionsThrown.remove(c);
        }
 
        /**
         * Remove all exceptions.
         */
        public void removeExceptions() {
-               throws_vec.clear();
+               exceptionsThrown.clear();
        }
 
        /*
         * @return array of thrown exceptions
         */
        public String[] getExceptions() {
-               String[] e = new String[throws_vec.size()];
-               throws_vec.toArray(e);
+               String[] e = new String[exceptionsThrown.size()];
+               exceptionsThrown.toArray(e);
                return e;
        }
 
@@ -617,12 +601,12 @@ public class MethodGen extends FieldGenOrMethodGen {
         * @return `Exceptions' attribute of all the exceptions thrown by this method.
         */
        private ExceptionTable getExceptionTable(ConstantPool cp) {
-               int size = throws_vec.size();
+               int size = exceptionsThrown.size();
                int[] ex = new int[size];
 
                try {
                        for (int i = 0; i < size; i++)
-                               ex[i] = cp.addClass(throws_vec.get(i));
+                               ex[i] = cp.addClass(exceptionsThrown.get(i));
                } catch (ArrayIndexOutOfBoundsException e) {
                }
 
@@ -742,7 +726,7 @@ public class MethodGen extends FieldGenOrMethodGen {
 
                ExceptionTable et = null;
 
-               if (throws_vec.size() > 0)
+               if (exceptionsThrown.size() > 0)
                        addAttribute(et = getExceptionTable(cp)); // Add `Exceptions' if there are "throws" clauses
 
                Method m = new Method(modifiers, name_index, signature_index, getAttributesImmutable(), cp);
@@ -824,7 +808,7 @@ public class MethodGen extends FieldGenOrMethodGen {
 
        public String[] getArgumentNames() {
                if (parameterNames != null)
-                       return (String[]) parameterNames.clone();
+                       return parameterNames.clone();
                else
                        return new String[0];
        }
@@ -845,6 +829,7 @@ public class MethodGen extends FieldGenOrMethodGen {
                this.il = il;
        }
 
+       @Override
        public String getSignature() {
                return Utility.toMethodSignature(type, parameterTypes);
        }
@@ -1014,6 +999,7 @@ public class MethodGen extends FieldGenOrMethodGen {
         * 
         * @return String representation of the method.
         */
+       @Override
        public final String toString() {
                String access = Utility.accessToString(modifiers);
                String signature = Utility.toMethodSignature(type, parameterTypes);
@@ -1022,29 +1008,14 @@ public class MethodGen extends FieldGenOrMethodGen {
 
                StringBuffer buf = new StringBuffer(signature);
 
-               if (throws_vec.size() > 0) {
-                       for (Iterator<String> e = throws_vec.iterator(); e.hasNext();)
+               if (exceptionsThrown.size() > 0) {
+                       for (Iterator<String> e = exceptionsThrown.iterator(); e.hasNext();)
                                buf.append("\n\t\tthrows " + e.next());
                }
 
                return buf.toString();
        }
 
-       /**
-        * @return deep copy of this method
-        */
-       public MethodGen copy(String class_name, ConstantPool cp) {
-               Method m = ((MethodGen) clone()).getMethod();
-               MethodGen mg = new MethodGen(m, class_name, this.cp);
-
-               if (this.cp != cp) {
-                       mg.setConstantPool(cp);
-                       mg.getInstructionList().replaceConstantPool(this.cp, cp);
-               }
-
-               return mg;
-       }
-
        // J5TODO: Should param_annotations be an array of arrays? Rather than an array of lists, this
        // is more likely to suggest to the caller it is readonly (which a List does not).
        /**
@@ -1064,22 +1035,22 @@ public class MethodGen extends FieldGenOrMethodGen {
         * object out of this MethodGen object).
         */
        private void ensureExistingParameterAnnotationsUnpacked() {
-               if (haveUnpackedParameterAnnotations)
+               if (haveUnpackedParameterAnnotations) {
                        return;
+               }
                // Find attributes that contain parameter annotation data
                List<Attribute> attrs = getAttributes();
                RuntimeParameterAnnotations paramAnnVisAttr = null;
                RuntimeParameterAnnotations paramAnnInvisAttr = null;
-               List accumulatedAnnotations = new ArrayList();
-               for (int i = 0; i < attrs.size(); i++) {
-                       Attribute attribute = attrs.get(i);
+
+               for (Attribute attribute : attrs) {
                        if (attribute instanceof RuntimeParameterAnnotations) {
 
-                               // Initialize param_annotations
                                if (!hasParameterAnnotations) {
                                        param_annotations = new List[parameterTypes.length];
-                                       for (int j = 0; j < parameterTypes.length; j++)
-                                               param_annotations[j] = new ArrayList();
+                                       for (int j = 0; j < parameterTypes.length; j++) {
+                                               param_annotations[j] = new ArrayList<AnnotationGen>();
+                                       }
                                }
 
                                hasParameterAnnotations = true;
@@ -1090,11 +1061,13 @@ public class MethodGen extends FieldGenOrMethodGen {
                                        paramAnnInvisAttr = rpa;
                                for (int j = 0; j < parameterTypes.length; j++) {
                                        // This returns Annotation[] ...
-                                       AnnotationGen[] immutableArray = rpa.getAnnotationsOnParameter(j);
+                                       AnnotationGen[] annos = rpa.getAnnotationsOnParameter(j);
                                        // ... which needs transforming into an AnnotationGen[] ...
-                                       List<AnnotationGen> mutable = makeMutableVersion(immutableArray);
+                                       // List<AnnotationGen> mutable = makeMutableVersion(immutableArray);
                                        // ... then add these to any we already know about
-                                       param_annotations[j].addAll(mutable);
+                                       for (AnnotationGen anAnnotation : annos) {
+                                               param_annotations[j].add(anAnnotation);
+                                       }
                                }
                        }
                }
@@ -1105,7 +1078,7 @@ public class MethodGen extends FieldGenOrMethodGen {
                haveUnpackedParameterAnnotations = true;
        }
 
-       private List /* AnnotationGen */<AnnotationGen>makeMutableVersion(AnnotationGen[] mutableArray) {
+       private List /* AnnotationGen */<AnnotationGen> makeMutableVersion(AnnotationGen[] mutableArray) {
                List<AnnotationGen> result = new ArrayList<AnnotationGen>();
                for (int i = 0; i < mutableArray.length; i++) {
                        result.add(new AnnotationGen(mutableArray[i], getConstantPool(), false));
index 5aa9545888050ab5436142371b69f0fedefeba86..e24a4a665ef42e115301b1eb1c6e37f50e10dd5c 100644 (file)
@@ -85,7 +85,7 @@ import org.aspectj.apache.bcel.verifier.InstructionWalker;
  * Factory creates il.append() statements, and sets instruction targets. A helper class for BCELifier.
  * 
  * @see BCELifier
- * @version $Id: BCELFactory.java,v 1.5 2009/09/09 19:56:20 aclement Exp $
+ * @version $Id: BCELFactory.java,v 1.6 2009/09/14 20:29:10 aclement Exp $
  * @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
  */
 class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor {
@@ -99,7 +99,8 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor {
                _out = out;
        }
 
-       private final HashMap<Instruction, InstructionHandle> branch_map = new HashMap<Instruction, InstructionHandle>(); // Map<Instruction, InstructionHandle>
+       private final HashMap<Instruction, InstructionHandle> branch_map = new HashMap<Instruction, InstructionHandle>(); // Map<Instruction,
+                                                                                                                                                                                                                                               // InstructionHandle>
 
        public void start() {
                if (!_mg.isAbstract() && !_mg.isNative()) {
@@ -134,7 +135,7 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor {
                short opcode = i.getOpcode();
 
                if (InstructionConstants.INSTRUCTIONS[opcode] != null && !i.isConstantInstruction() && !i.isReturnInstruction()) { // Handled
-                                                                                                                                                                                                                                                       // below
+                       // below
                        _out.println("il.append(InstructionConstants." + i.getName().toUpperCase() + ");");
                        return true;
                }
@@ -154,6 +155,7 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor {
                }
        }
 
+       @Override
        public void visitArrayInstruction(Instruction i) {
                short opcode = i.getOpcode();
                Type type = i.getType(_cp);
@@ -173,6 +175,7 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor {
                                + BCELifier.printType(type) + ", " + "Constants." + Constants.OPCODE_NAMES[opcode].toUpperCase() + "));");
        }
 
+       @Override
        public void visitInvokeInstruction(InvokeInstruction i) {
                short opcode = i.getOpcode();
                String class_name = i.getClassName(_cp);
@@ -185,6 +188,7 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor {
                                + Constants.OPCODE_NAMES[opcode].toUpperCase() + "));");
        }
 
+       @Override
        public void visitAllocationInstruction(Instruction i) {
                Type type;
 
@@ -204,7 +208,6 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor {
 
                case Constants.MULTIANEWARRAY:
                        dim = ((MULTIANEWARRAY) i).getDimensions();
-
                case Constants.ANEWARRAY:
                case Constants.NEWARRAY:
                        _out.println("il.append(_factory.createNewArray(" + BCELifier.printType(type) + ", (short) " + dim + "));");
@@ -227,30 +230,36 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor {
                _out.println("il.append(new PUSH(_cp, " + embed + "));");
        }
 
+       @Override
        public void visitLDC(Instruction i) {
                createConstant(i.getValue(_cp));
        }
 
+       @Override
        public void visitLDC2_W(Instruction i) {
                createConstant(i.getValue(_cp));
        }
 
+       @Override
        public void visitConstantPushInstruction(Instruction i) {
                createConstant(i.getValue());
        }
 
+       @Override
        public void visitINSTANCEOF(Instruction i) {
                Type type = i.getType(_cp);
 
                _out.println("il.append(new INSTANCEOF(_cp.addClass(" + BCELifier.printType(type) + ")));");
        }
 
+       @Override
        public void visitCHECKCAST(Instruction i) {
                Type type = i.getType(_cp);
 
                _out.println("il.append(_factory.createCheckCast(" + BCELifier.printType(type) + "));");
        }
 
+       @Override
        public void visitReturnInstruction(Instruction i) {
                Type type = i.getType(_cp);
 
@@ -260,6 +269,7 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor {
        // Memorize BranchInstructions that need an update
        private final ArrayList<InstructionBranch> branches = new ArrayList<InstructionBranch>();
 
+       @Override
        public void visitBranchInstruction(InstructionBranch bi) {
                BranchHandle bh = (BranchHandle) branch_map.get(bi);
                int pos = bh.getPosition();
@@ -315,6 +325,7 @@ class BCELFactory extends org.aspectj.apache.bcel.verifier.EmptyInstVisitor {
                }
        }
 
+       @Override
        public void visitRET(RET i) {
                _out.println("il.append(new RET(" + i.getIndex() + ")));");
        }