You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bcel-dev@jakarta.apache.org by tc...@apache.org on 2006/03/15 12:33:43 UTC

svn commit: r386056 [16/28] - in /jakarta/bcel/trunk: examples/ examples/Mini/ src/java/org/apache/bcel/ src/java/org/apache/bcel/classfile/ src/java/org/apache/bcel/generic/ src/java/org/apache/bcel/util/ src/java/org/apache/bcel/verifier/ src/java/or...

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ISUB.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ISUB.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ISUB.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ISUB.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.generic;
 
-
 /** 
  * ISUB - Substract ints
  * <PRE>Stack: ..., value1, value2 -&gt; result</PRE>
@@ -25,26 +24,27 @@
  * @author  <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
  */
 public class ISUB extends ArithmeticInstruction {
-  /** Substract ints
-   */
-  public ISUB() {
-    super(org.apache.bcel.Constants.ISUB);
-  }
+
+    /** Substract ints
+     */
+    public ISUB() {
+        super(org.apache.bcel.Constants.ISUB);
+    }
 
 
-  /**
-   * Call corresponding visitor method(s). The order is:
-   * Call visitor methods of implemented interfaces first, then
-   * call methods according to the class hierarchy in descending order,
-   * i.e., the most specific visitXXX() call comes last.
-   *
-   * @param v Visitor object
-   */
-  public void accept(Visitor v) {
-    v.visitTypedInstruction(this);
-    v.visitStackProducer(this);
-    v.visitStackConsumer(this);
-    v.visitArithmeticInstruction(this);
-    v.visitISUB(this);
-  }
+    /**
+     * Call corresponding visitor method(s). The order is:
+     * Call visitor methods of implemented interfaces first, then
+     * call methods according to the class hierarchy in descending order,
+     * i.e., the most specific visitXXX() call comes last.
+     *
+     * @param v Visitor object
+     */
+    public void accept( Visitor v ) {
+        v.visitTypedInstruction(this);
+        v.visitStackProducer(this);
+        v.visitStackConsumer(this);
+        v.visitArithmeticInstruction(this);
+        v.visitISUB(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IUSHR.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IUSHR.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IUSHR.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IUSHR.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.generic;
 
-
 /** 
  * IUSHR - Logical shift right int
  * <PRE>Stack: ..., value1, value2 -&gt; ..., result</PRE>
@@ -25,24 +24,25 @@
  * @author  <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
  */
 public class IUSHR extends ArithmeticInstruction {
-  public IUSHR() {
-    super(org.apache.bcel.Constants.IUSHR);
-  }
+
+    public IUSHR() {
+        super(org.apache.bcel.Constants.IUSHR);
+    }
 
 
-  /**
-   * Call corresponding visitor method(s). The order is:
-   * Call visitor methods of implemented interfaces first, then
-   * call methods according to the class hierarchy in descending order,
-   * i.e., the most specific visitXXX() call comes last.
-   *
-   * @param v Visitor object
-   */
-  public void accept(Visitor v) {
-    v.visitTypedInstruction(this);
-    v.visitStackProducer(this);
-    v.visitStackConsumer(this);
-    v.visitArithmeticInstruction(this);
-    v.visitIUSHR(this);
-  }
+    /**
+     * Call corresponding visitor method(s). The order is:
+     * Call visitor methods of implemented interfaces first, then
+     * call methods according to the class hierarchy in descending order,
+     * i.e., the most specific visitXXX() call comes last.
+     *
+     * @param v Visitor object
+     */
+    public void accept( Visitor v ) {
+        v.visitTypedInstruction(this);
+        v.visitStackProducer(this);
+        v.visitStackConsumer(this);
+        v.visitArithmeticInstruction(this);
+        v.visitIUSHR(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IXOR.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IXOR.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IXOR.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IXOR.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.generic;
 
-
 /** 
  * IXOR - Bitwise XOR int
  * <PRE>Stack: ..., value1, value2 -&gt; ..., result</PRE>
@@ -25,24 +24,25 @@
  * @author  <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
  */
 public class IXOR extends ArithmeticInstruction {
-  public IXOR() {
-    super(org.apache.bcel.Constants.IXOR);
-  }
+
+    public IXOR() {
+        super(org.apache.bcel.Constants.IXOR);
+    }
 
 
-  /**
-   * Call corresponding visitor method(s). The order is:
-   * Call visitor methods of implemented interfaces first, then
-   * call methods according to the class hierarchy in descending order,
-   * i.e., the most specific visitXXX() call comes last.
-   *
-   * @param v Visitor object
-   */
-  public void accept(Visitor v) {
-    v.visitTypedInstruction(this);
-    v.visitStackProducer(this);
-    v.visitStackConsumer(this);
-    v.visitArithmeticInstruction(this);
-    v.visitIXOR(this);
-  }
+    /**
+     * Call corresponding visitor method(s). The order is:
+     * Call visitor methods of implemented interfaces first, then
+     * call methods according to the class hierarchy in descending order,
+     * i.e., the most specific visitXXX() call comes last.
+     *
+     * @param v Visitor object
+     */
+    public void accept( Visitor v ) {
+        v.visitTypedInstruction(this);
+        v.visitStackProducer(this);
+        v.visitStackConsumer(this);
+        v.visitArithmeticInstruction(this);
+        v.visitIXOR(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IfInstruction.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IfInstruction.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IfInstruction.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IfInstruction.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.generic;
 
-
 /**
  * Super class for the IFxxx family of instructions.
  *
@@ -24,23 +23,26 @@
  * @author  <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
  */
 public abstract class IfInstruction extends BranchInstruction implements StackConsumer {
-  /**
-   * Empty constructor needed for the Class.newInstance() statement in
-   * Instruction.readInstruction(). Not to be used otherwise.
-   */
-  IfInstruction() {}
-
-  /**
-   * @param opcode opcode of instruction
-   * @param target Target instruction to branch to
-   */
-  protected IfInstruction(short opcode, InstructionHandle target) {
-    super(opcode, target);
-  }
-
-  /**
-   * @return negation of instruction, e.g. IFEQ.negate() == IFNE
-   */
-  public abstract IfInstruction negate();
-}
 
+    /**
+     * Empty constructor needed for the Class.newInstance() statement in
+     * Instruction.readInstruction(). Not to be used otherwise.
+     */
+    IfInstruction() {
+    }
+
+
+    /**
+     * @param opcode opcode of instruction
+     * @param target Target instruction to branch to
+     */
+    protected IfInstruction(short opcode, InstructionHandle target) {
+        super(opcode, target);
+    }
+
+
+    /**
+     * @return negation of instruction, e.g. IFEQ.negate() == IFNE
+     */
+    public abstract IfInstruction negate();
+}

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IndexedInstruction.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IndexedInstruction.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IndexedInstruction.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/IndexedInstruction.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.generic;
 
-
 /**
  * Denote entity that refers to an index, e.g. local variable instructions,
  * RET, CPInstruction, etc.
@@ -25,7 +24,9 @@
  * @author  <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
  */
 public interface IndexedInstruction {
-  public int getIndex();
-  public void setIndex(int index);
-}
 
+    public int getIndex();
+
+
+    public void setIndex( int index );
+}

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/Instruction.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/Instruction.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/Instruction.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/Instruction.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.generic;
 
-
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.Serializable;
@@ -32,239 +31,262 @@
  * @author  <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
  */
 public abstract class Instruction implements Cloneable, Serializable {
-  protected short length = 1;  // Length of instruction in bytes 
-  protected short opcode = -1; // Opcode number
 
-  private static InstructionComparator cmp = InstructionComparator.DEFAULT;
+    protected short length = 1; // Length of instruction in bytes 
+    protected short opcode = -1; // Opcode number
+    private static InstructionComparator cmp = InstructionComparator.DEFAULT;
+
+
+    /**
+     * Empty constructor needed for the Class.newInstance() statement in
+     * Instruction.readInstruction(). Not to be used otherwise.
+     */
+    Instruction() {
+    }
+
+
+    public Instruction(short opcode, short length) {
+        this.length = length;
+        this.opcode = opcode;
+    }
+
+
+    /**
+     * Dump instruction as byte code to stream out.
+     * @param out Output stream
+     */
+    public void dump( DataOutputStream out ) throws IOException {
+        out.writeByte(opcode); // Common for all instructions
+    }
+
+
+    /** @return name of instruction, i.e., opcode name
+     */
+    public String getName() {
+        return Constants.OPCODE_NAMES[opcode];
+    }
+
+
+    /**
+     * Long output format:
+     *
+     * &lt;name of opcode&gt; "["&lt;opcode number&gt;"]" 
+     * "("&lt;length of instruction&gt;")"
+     *
+     * @param verbose long/short format switch
+     * @return mnemonic for instruction
+     */
+    public String toString( boolean verbose ) {
+        if (verbose) {
+            return getName() + "[" + opcode + "](" + length + ")";
+        } else {
+            return getName();
+        }
+    }
+
+
+    /**
+     * @return mnemonic for instruction in verbose format
+     */
+    public String toString() {
+        return toString(true);
+    }
+
+
+    /**
+     * @return mnemonic for instruction with sumbolic references resolved
+     */
+    public String toString( ConstantPool cp ) {
+        return toString(false);
+    }
+
+
+    /**
+     * Use with caution, since `BranchInstruction's have a `target' reference which
+     * is not copied correctly (only basic types are). This also applies for 
+     * `Select' instructions with their multiple branch targets.
+     *
+     * @see BranchInstruction
+     * @return (shallow) copy of an instruction
+     */
+    public Instruction copy() {
+        Instruction i = null;
+        // "Constant" instruction, no need to duplicate
+        if (InstructionConstants.INSTRUCTIONS[this.getOpcode()] != null) {
+            i = this;
+        } else {
+            try {
+                i = (Instruction) clone();
+            } catch (CloneNotSupportedException e) {
+                System.err.println(e);
+            }
+        }
+        return i;
+    }
+
+
+    /**
+     * Read needed data (e.g. index) from file.
+     *
+     * @param bytes byte sequence to read from
+     * @param wide "wide" instruction flag
+     */
+    protected void initFromFile( ByteSequence bytes, boolean wide ) throws IOException {
+    }
+
+
+    /**
+     * Read an instruction from (byte code) input stream and return the
+     * appropiate object.
+     *
+     * @param bytes input stream bytes
+     * @return instruction object being read
+     */
+    public static final Instruction readInstruction( ByteSequence bytes ) throws IOException {
+        boolean wide = false;
+        short opcode = (short) bytes.readUnsignedByte();
+        Instruction obj = null;
+        if (opcode == Constants.WIDE) { // Read next opcode after wide byte
+            wide = true;
+            opcode = (short) bytes.readUnsignedByte();
+        }
+        if (InstructionConstants.INSTRUCTIONS[opcode] != null) {
+            return InstructionConstants.INSTRUCTIONS[opcode]; // Used predefined immutable object, if available
+        }
+        /* Find appropiate class, instantiate an (empty) instruction object
+         * and initialize it by hand.
+         */
+        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.");
+        }
+        try {
+            obj = (Instruction) clazz.newInstance();
+            if (wide
+                    && !((obj instanceof LocalVariableInstruction) || (obj instanceof IINC) || (obj instanceof RET))) {
+                throw new Exception("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;
+    }
+
+
+    private static final String className( short opcode ) {
+        String name = Constants.OPCODE_NAMES[opcode].toUpperCase(Locale.ENGLISH);
+        /* ICONST_0, etc. will be shortened to ICONST, etc., since ICONST_0 and the like
+         * are not implemented (directly).
+         */
+        try {
+            int len = name.length();
+            char ch1 = name.charAt(len - 2), ch2 = name.charAt(len - 1);
+            if ((ch1 == '_') && (ch2 >= '0') && (ch2 <= '5')) {
+                name = name.substring(0, len - 2);
+            }
+            if (name.equals("ICONST_M1")) {
+                name = "ICONST";
+            }
+        } catch (StringIndexOutOfBoundsException e) {
+            System.err.println(e);
+        }
+        return "org.apache.bcel.generic." + name;
+    }
+
+
+    /**
+     * This method also gives right results for instructions whose
+     * effect on the stack depends on the constant pool entry they
+     * reference.
+     *  @return Number of words consumed from stack by this instruction,
+     * or Constants.UNPREDICTABLE, if this can not be computed statically
+     */
+    public int consumeStack( ConstantPoolGen cpg ) {
+        return Constants.CONSUME_STACK[opcode];
+    }
+
+
+    /**
+     * This method also gives right results for instructions whose
+     * effect on the stack depends on the constant pool entry they
+     * reference.
+     * @return Number of words produced onto stack by this instruction,
+     * or Constants.UNPREDICTABLE, if this can not be computed statically
+     */
+    public int produceStack( ConstantPoolGen cpg ) {
+        return Constants.PRODUCE_STACK[opcode];
+    }
 
-  /**
-   * Empty constructor needed for the Class.newInstance() statement in
-   * Instruction.readInstruction(). Not to be used otherwise.
-   */
-  Instruction() {}
-
-  public Instruction(short opcode, short length) {
-    this.length = length;
-    this.opcode = opcode;
-  }
-
-  /**
-   * Dump instruction as byte code to stream out.
-   * @param out Output stream
-   */
-  public void dump(DataOutputStream out) throws IOException {
-    out.writeByte(opcode); // Common for all instructions
-  }
-
-  /** @return name of instruction, i.e., opcode name
-   */
-  public String getName() {
-    return Constants.OPCODE_NAMES[opcode];
-  }
-
-  /**
-   * Long output format:
-   *
-   * &lt;name of opcode&gt; "["&lt;opcode number&gt;"]" 
-   * "("&lt;length of instruction&gt;")"
-   *
-   * @param verbose long/short format switch
-   * @return mnemonic for instruction
-   */
-  public String toString(boolean verbose) {
-    if(verbose)
-      return getName() + "[" + opcode + "](" + length + ")";
-    else
-      return getName();
-  }
-
-  /**
-   * @return mnemonic for instruction in verbose format
-   */
-  public String toString() {
-    return toString(true);
-  }
-
-  /**
-   * @return mnemonic for instruction with sumbolic references resolved
-   */
-  public String toString(ConstantPool cp) {
-    return toString(false);
-  }
-
-  /**
-   * Use with caution, since `BranchInstruction's have a `target' reference which
-   * is not copied correctly (only basic types are). This also applies for 
-   * `Select' instructions with their multiple branch targets.
-   *
-   * @see BranchInstruction
-   * @return (shallow) copy of an instruction
-   */
-  public Instruction copy() {
-    Instruction i = null;
-
-    // "Constant" instruction, no need to duplicate
-    if(InstructionConstants.INSTRUCTIONS[this.getOpcode()] != null)
-      i = this;
-    else {
-      try {
-	i = (Instruction)clone();
-      } catch(CloneNotSupportedException e) {
-	System.err.println(e);
-      }
-    }
-
-    return i;
-  }
-  
-  /**
-   * Read needed data (e.g. index) from file.
-   *
-   * @param bytes byte sequence to read from
-   * @param wide "wide" instruction flag
-   */
-  protected void initFromFile(ByteSequence bytes, boolean wide)
-    throws IOException
-  {}  
-
-  /**
-   * Read an instruction from (byte code) input stream and return the
-   * appropiate object.
-   *
-   * @param bytes input stream bytes
-   * @return instruction object being read
-   */
-  public static final Instruction readInstruction(ByteSequence bytes)
-    throws IOException
-  {
-    boolean     wide   = false;
-    short       opcode = (short)bytes.readUnsignedByte();
-    Instruction obj    = null;
-
-    if(opcode == Constants.WIDE) { // Read next opcode after wide byte
-      wide = true;
-      opcode  = (short)bytes.readUnsignedByte();
-    }
-
-    if(InstructionConstants.INSTRUCTIONS[opcode] != null)
-      return InstructionConstants.INSTRUCTIONS[opcode]; // Used predefined immutable object, if available
-
-    /* Find appropiate class, instantiate an (empty) instruction object
-     * and initialize it by hand.
-     */
-    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.");
-    }
-
-    try {
-      obj = (Instruction)clazz.newInstance();
-
-      if(wide && !((obj instanceof LocalVariableInstruction) ||
-		   (obj instanceof IINC) ||
-		   (obj instanceof RET)))
-	throw new Exception("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;
-  }
-
-  private static final String className(short opcode) {
-    String name = Constants.OPCODE_NAMES[opcode].toUpperCase(Locale.ENGLISH);
-
-    /* ICONST_0, etc. will be shortened to ICONST, etc., since ICONST_0 and the like
-     * are not implemented (directly).
-     */
-    try {
-      int  len = name.length();
-      char ch1 = name.charAt(len - 2), ch2 = name.charAt(len - 1);
-
-      if((ch1 == '_') && (ch2 >= '0')  && (ch2 <= '5'))
-	name = name.substring(0, len - 2);
-      
-      if(name.equals("ICONST_M1")) // Special case
-	name = "ICONST";
-    } catch(StringIndexOutOfBoundsException e) { System.err.println(e); }
-
-    return "org.apache.bcel.generic." + name;
-  }
-
-  /**
-   * This method also gives right results for instructions whose
-   * effect on the stack depends on the constant pool entry they
-   * reference.
-   *  @return Number of words consumed from stack by this instruction,
-   * or Constants.UNPREDICTABLE, if this can not be computed statically
-   */
-  public int consumeStack(ConstantPoolGen cpg) {
-    return Constants.CONSUME_STACK[opcode];
-  }
-
-  /**
-   * This method also gives right results for instructions whose
-   * effect on the stack depends on the constant pool entry they
-   * reference.
-   * @return Number of words produced onto stack by this instruction,
-   * or Constants.UNPREDICTABLE, if this can not be computed statically
-   */
-  public int produceStack(ConstantPoolGen cpg) {
-    return Constants.PRODUCE_STACK[opcode];
-  }
-
-  /**
-   * @return this instructions opcode
-   */
-  public short getOpcode()    { return opcode; }
-
-  /**
-   * @return length (in bytes) of instruction
-   */
-  public int getLength()   { return length; }
-
-  /**
-   * Needed in readInstruction.
-   */
-  private void setOpcode(short opcode) { this.opcode = opcode; }
-
-  /** Some instructions may be reused, so don't do anything by default.
-   */
-  void dispose() {}
-
-  /**
-   * Call corresponding visitor method(s). The order is:
-   * Call visitor methods of implemented interfaces first, then
-   * call methods according to the class hierarchy in descending order,
-   * i.e., the most specific visitXXX() call comes last.
-   *
-   * @param v Visitor object
-   */
-  public abstract void accept(Visitor v);
-
-  /** Get Comparator object used in the equals() method to determine
-   * equality of instructions.
-   *
-   * @return currently used comparator for equals()
-   */
-  public static InstructionComparator getComparator() { return cmp; }
-
-  /** Set comparator to be used for equals().
-   */
-  public static void setComparator(InstructionComparator c) { cmp = c; }
-
-  /** Check for equality, delegated to comparator
-   * @return true if that is an Instruction and has the same opcode
-   */
-  public boolean equals(Object that) {
-    return (that instanceof Instruction)?
-      cmp.equals(this, (Instruction)that) : false;
-  }
+
+    /**
+     * @return this instructions opcode
+     */
+    public short getOpcode() {
+        return opcode;
+    }
+
+
+    /**
+     * @return length (in bytes) of instruction
+     */
+    public int getLength() {
+        return length;
+    }
+
+
+    /**
+     * Needed in readInstruction.
+     */
+    private void setOpcode( short opcode ) {
+        this.opcode = opcode;
+    }
+
+
+    /** Some instructions may be reused, so don't do anything by default.
+     */
+    void dispose() {
+    }
+
+
+    /**
+     * Call corresponding visitor method(s). The order is:
+     * Call visitor methods of implemented interfaces first, then
+     * call methods according to the class hierarchy in descending order,
+     * i.e., the most specific visitXXX() call comes last.
+     *
+     * @param v Visitor object
+     */
+    public abstract void accept( Visitor v );
+
+
+    /** Get Comparator object used in the equals() method to determine
+     * equality of instructions.
+     *
+     * @return currently used comparator for equals()
+     */
+    public static InstructionComparator getComparator() {
+        return cmp;
+    }
+
+
+    /** Set comparator to be used for equals().
+     */
+    public static void setComparator( InstructionComparator c ) {
+        cmp = c;
+    }
+
+
+    /** Check for equality, delegated to comparator
+     * @return true if that is an Instruction and has the same opcode
+     */
+    public boolean equals( Object that ) {
+        return (that instanceof Instruction) ? cmp.equals(this, (Instruction) that) : false;
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/InstructionComparator.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/InstructionComparator.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/InstructionComparator.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/InstructionComparator.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.generic;
 
-
 /**
  * Equality of instructions isn't clearly to be defined. You might
  * wish, for example, to compare whether instructions have the same
@@ -31,42 +30,40 @@
  * @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
  */
 public interface InstructionComparator {
-  public static final InstructionComparator DEFAULT =
-    new InstructionComparator() {
-	public boolean equals(Instruction i1, Instruction i2) {
-	  if(i1.opcode == i2.opcode) {
-	    if(i1 instanceof Select) {
-	      InstructionHandle[] t1 = ((Select)i1).getTargets();
-	      InstructionHandle[] t2 = ((Select)i2).getTargets();
 
-	      if(t1.length == t2.length) {
-		for(int i = 0; i < t1.length; i++) {
-		  if(t1[i] != t2[i]) {
-		    return false;
-		  }
-		}
-		
-		return true;
-	      }
-	    } else if(i1 instanceof BranchInstruction) {
-	      return ((BranchInstruction)i1).target == 
-		((BranchInstruction)i2).target;
-	    } else if(i1 instanceof ConstantPushInstruction) {
-	      return ((ConstantPushInstruction)i1).getValue().
-		equals(((ConstantPushInstruction)i2).getValue());
-	    } else if(i1 instanceof IndexedInstruction) {
-	      return ((IndexedInstruction)i1).getIndex() == 
-		((IndexedInstruction)i2).getIndex();
-	    } else if(i1 instanceof NEWARRAY) {
-	      return ((NEWARRAY)i1).getTypecode() == ((NEWARRAY)i2).getTypecode();
-	    } else {
-	      return true;
-	    }
-	  }
+    public static final InstructionComparator DEFAULT = new InstructionComparator() {
+
+        public boolean equals( Instruction i1, Instruction i2 ) {
+            if (i1.opcode == i2.opcode) {
+                if (i1 instanceof Select) {
+                    InstructionHandle[] t1 = ((Select) i1).getTargets();
+                    InstructionHandle[] t2 = ((Select) i2).getTargets();
+                    if (t1.length == t2.length) {
+                        for (int i = 0; i < t1.length; i++) {
+                            if (t1[i] != t2[i]) {
+                                return false;
+                            }
+                        }
+                        return true;
+                    }
+                } else if (i1 instanceof BranchInstruction) {
+                    return ((BranchInstruction) i1).target == ((BranchInstruction) i2).target;
+                } else if (i1 instanceof ConstantPushInstruction) {
+                    return ((ConstantPushInstruction) i1).getValue().equals(
+                            ((ConstantPushInstruction) i2).getValue());
+                } else if (i1 instanceof IndexedInstruction) {
+                    return ((IndexedInstruction) i1).getIndex() == ((IndexedInstruction) i2)
+                            .getIndex();
+                } else if (i1 instanceof NEWARRAY) {
+                    return ((NEWARRAY) i1).getTypecode() == ((NEWARRAY) i2).getTypecode();
+                } else {
+                    return true;
+                }
+            }
+            return false;
+        }
+    };
 
-	  return false;
-	}
-      };
 
-  public boolean equals(Instruction i1, Instruction i2);
+    public boolean equals( Instruction i1, Instruction i2 );
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/InstructionConstants.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/InstructionConstants.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/InstructionConstants.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/InstructionConstants.java Wed Mar 15 03:31:56 2006
@@ -13,10 +13,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.generic;
 
-
 import org.apache.bcel.Constants;
 
 /** 
@@ -37,253 +36,251 @@
  * @author  <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
  */
 public interface InstructionConstants {
-  /** Predefined instruction objects
-   */
-  public static final Instruction           NOP          = new NOP();
-  public static final Instruction           ACONST_NULL  = new ACONST_NULL();
-  public static final Instruction           ICONST_M1    = new ICONST(-1);
-  public static final Instruction           ICONST_0     = new ICONST(0);
-  public static final Instruction           ICONST_1     = new ICONST(1);
-  public static final Instruction           ICONST_2     = new ICONST(2);
-  public static final Instruction           ICONST_3     = new ICONST(3);
-  public static final Instruction           ICONST_4     = new ICONST(4);
-  public static final Instruction           ICONST_5     = new ICONST(5);
-  public static final Instruction           LCONST_0     = new LCONST(0);
-  public static final Instruction           LCONST_1     = new LCONST(1);
-  public static final Instruction           FCONST_0     = new FCONST(0);
-  public static final Instruction           FCONST_1     = new FCONST(1);
-  public static final Instruction           FCONST_2     = new FCONST(2);
-  public static final Instruction           DCONST_0     = new DCONST(0);
-  public static final Instruction           DCONST_1     = new DCONST(1);
-  public static final ArrayInstruction      IALOAD       = new IALOAD();
-  public static final ArrayInstruction      LALOAD       = new LALOAD();
-  public static final ArrayInstruction      FALOAD       = new FALOAD();
-  public static final ArrayInstruction      DALOAD       = new DALOAD();
-  public static final ArrayInstruction      AALOAD       = new AALOAD();
-  public static final ArrayInstruction      BALOAD       = new BALOAD();
-  public static final ArrayInstruction      CALOAD       = new CALOAD();
-  public static final ArrayInstruction      SALOAD       = new SALOAD();
-  public static final ArrayInstruction      IASTORE      = new IASTORE();
-  public static final ArrayInstruction      LASTORE      = new LASTORE();
-  public static final ArrayInstruction      FASTORE      = new FASTORE();
-  public static final ArrayInstruction      DASTORE      = new DASTORE();
-  public static final ArrayInstruction      AASTORE      = new AASTORE();
-  public static final ArrayInstruction      BASTORE      = new BASTORE();
-  public static final ArrayInstruction      CASTORE      = new CASTORE();
-  public static final ArrayInstruction      SASTORE      = new SASTORE();
-  public static final StackInstruction      POP          = new POP();
-  public static final StackInstruction      POP2         = new POP2();
-  public static final StackInstruction      DUP          = new DUP();
-  public static final StackInstruction      DUP_X1       = new DUP_X1();
-  public static final StackInstruction      DUP_X2       = new DUP_X2();
-  public static final StackInstruction      DUP2         = new DUP2();
-  public static final StackInstruction      DUP2_X1      = new DUP2_X1();
-  public static final StackInstruction      DUP2_X2      = new DUP2_X2();
-  public static final StackInstruction      SWAP         = new SWAP();
-  public static final ArithmeticInstruction IADD         = new IADD();
-  public static final ArithmeticInstruction LADD         = new LADD();
-  public static final ArithmeticInstruction FADD         = new FADD();
-  public static final ArithmeticInstruction DADD         = new DADD();
-  public static final ArithmeticInstruction ISUB         = new ISUB();
-  public static final ArithmeticInstruction LSUB         = new LSUB();
-  public static final ArithmeticInstruction FSUB         = new FSUB();
-  public static final ArithmeticInstruction DSUB         = new DSUB();
-  public static final ArithmeticInstruction IMUL         = new IMUL();
-  public static final ArithmeticInstruction LMUL         = new LMUL();
-  public static final ArithmeticInstruction FMUL         = new FMUL();
-  public static final ArithmeticInstruction DMUL         = new DMUL();
-  public static final ArithmeticInstruction IDIV         = new IDIV();
-  public static final ArithmeticInstruction LDIV         = new LDIV();
-  public static final ArithmeticInstruction FDIV         = new FDIV();
-  public static final ArithmeticInstruction DDIV         = new DDIV();
-  public static final ArithmeticInstruction IREM         = new IREM();
-  public static final ArithmeticInstruction LREM         = new LREM();
-  public static final ArithmeticInstruction FREM         = new FREM();
-  public static final ArithmeticInstruction DREM         = new DREM();
-  public static final ArithmeticInstruction INEG         = new INEG();
-  public static final ArithmeticInstruction LNEG         = new LNEG();
-  public static final ArithmeticInstruction FNEG         = new FNEG();
-  public static final ArithmeticInstruction DNEG         = new DNEG();
-  public static final ArithmeticInstruction ISHL         = new ISHL();
-  public static final ArithmeticInstruction LSHL         = new LSHL();
-  public static final ArithmeticInstruction ISHR         = new ISHR();
-  public static final ArithmeticInstruction LSHR         = new LSHR();
-  public static final ArithmeticInstruction IUSHR        = new IUSHR();
-  public static final ArithmeticInstruction LUSHR        = new LUSHR();
-  public static final ArithmeticInstruction IAND         = new IAND();
-  public static final ArithmeticInstruction LAND         = new LAND();
-  public static final ArithmeticInstruction IOR          = new IOR();
-  public static final ArithmeticInstruction LOR          = new LOR();
-  public static final ArithmeticInstruction IXOR         = new IXOR();
-  public static final ArithmeticInstruction LXOR         = new LXOR();
-  public static final ConversionInstruction I2L          = new I2L();
-  public static final ConversionInstruction I2F          = new I2F();
-  public static final ConversionInstruction I2D          = new I2D();
-  public static final ConversionInstruction L2I          = new L2I();
-  public static final ConversionInstruction L2F          = new L2F();
-  public static final ConversionInstruction L2D          = new L2D();
-  public static final ConversionInstruction F2I          = new F2I();
-  public static final ConversionInstruction F2L          = new F2L();
-  public static final ConversionInstruction F2D          = new F2D();
-  public static final ConversionInstruction D2I          = new D2I();
-  public static final ConversionInstruction D2L          = new D2L();
-  public static final ConversionInstruction D2F          = new D2F();
-  public static final ConversionInstruction I2B          = new I2B();
-  public static final ConversionInstruction I2C          = new I2C();
-  public static final ConversionInstruction I2S          = new I2S();
-  public static final Instruction           LCMP         = new LCMP();
-  public static final Instruction           FCMPL        = new FCMPL();
-  public static final Instruction           FCMPG        = new FCMPG();
-  public static final Instruction           DCMPL        = new DCMPL();
-  public static final Instruction           DCMPG        = new DCMPG();
-  public static final ReturnInstruction     IRETURN      = new IRETURN();
-  public static final ReturnInstruction     LRETURN      = new LRETURN();
-  public static final ReturnInstruction     FRETURN      = new FRETURN();
-  public static final ReturnInstruction     DRETURN      = new DRETURN();
-  public static final ReturnInstruction     ARETURN      = new ARETURN();
-  public static final ReturnInstruction     RETURN       = new RETURN();
-  public static final Instruction           ARRAYLENGTH  = new ARRAYLENGTH();
-  public static final Instruction           ATHROW       = new ATHROW();
-  public static final Instruction           MONITORENTER = new MONITORENTER();
-  public static final Instruction           MONITOREXIT  = new MONITOREXIT();
-
-  /** You can use these constants in multiple places safely, if you can guarantee
-   * that you will never alter their internal values, e.g. call setIndex().
-   */
-  public static final LocalVariableInstruction THIS    = new ALOAD(0);
-  public static final LocalVariableInstruction ALOAD_0 = THIS;
-  public static final LocalVariableInstruction ALOAD_1 = new ALOAD(1);
-  public static final LocalVariableInstruction ALOAD_2 = new ALOAD(2);
-  public static final LocalVariableInstruction ILOAD_0 = new ILOAD(0);
-  public static final LocalVariableInstruction ILOAD_1 = new ILOAD(1);
-  public static final LocalVariableInstruction ILOAD_2 = new ILOAD(2);
-  public static final LocalVariableInstruction ASTORE_0 = new ASTORE(0);
-  public static final LocalVariableInstruction ASTORE_1 = new ASTORE(1);
-  public static final LocalVariableInstruction ASTORE_2 = new ASTORE(2);
-  public static final LocalVariableInstruction ISTORE_0 = new ISTORE(0);
-  public static final LocalVariableInstruction ISTORE_1 = new ISTORE(1);
-  public static final LocalVariableInstruction ISTORE_2 = new ISTORE(2);
 
+    /** Predefined instruction objects
+     */
+    public static final Instruction NOP = new NOP();
+    public static final Instruction ACONST_NULL = new ACONST_NULL();
+    public static final Instruction ICONST_M1 = new ICONST(-1);
+    public static final Instruction ICONST_0 = new ICONST(0);
+    public static final Instruction ICONST_1 = new ICONST(1);
+    public static final Instruction ICONST_2 = new ICONST(2);
+    public static final Instruction ICONST_3 = new ICONST(3);
+    public static final Instruction ICONST_4 = new ICONST(4);
+    public static final Instruction ICONST_5 = new ICONST(5);
+    public static final Instruction LCONST_0 = new LCONST(0);
+    public static final Instruction LCONST_1 = new LCONST(1);
+    public static final Instruction FCONST_0 = new FCONST(0);
+    public static final Instruction FCONST_1 = new FCONST(1);
+    public static final Instruction FCONST_2 = new FCONST(2);
+    public static final Instruction DCONST_0 = new DCONST(0);
+    public static final Instruction DCONST_1 = new DCONST(1);
+    public static final ArrayInstruction IALOAD = new IALOAD();
+    public static final ArrayInstruction LALOAD = new LALOAD();
+    public static final ArrayInstruction FALOAD = new FALOAD();
+    public static final ArrayInstruction DALOAD = new DALOAD();
+    public static final ArrayInstruction AALOAD = new AALOAD();
+    public static final ArrayInstruction BALOAD = new BALOAD();
+    public static final ArrayInstruction CALOAD = new CALOAD();
+    public static final ArrayInstruction SALOAD = new SALOAD();
+    public static final ArrayInstruction IASTORE = new IASTORE();
+    public static final ArrayInstruction LASTORE = new LASTORE();
+    public static final ArrayInstruction FASTORE = new FASTORE();
+    public static final ArrayInstruction DASTORE = new DASTORE();
+    public static final ArrayInstruction AASTORE = new AASTORE();
+    public static final ArrayInstruction BASTORE = new BASTORE();
+    public static final ArrayInstruction CASTORE = new CASTORE();
+    public static final ArrayInstruction SASTORE = new SASTORE();
+    public static final StackInstruction POP = new POP();
+    public static final StackInstruction POP2 = new POP2();
+    public static final StackInstruction DUP = new DUP();
+    public static final StackInstruction DUP_X1 = new DUP_X1();
+    public static final StackInstruction DUP_X2 = new DUP_X2();
+    public static final StackInstruction DUP2 = new DUP2();
+    public static final StackInstruction DUP2_X1 = new DUP2_X1();
+    public static final StackInstruction DUP2_X2 = new DUP2_X2();
+    public static final StackInstruction SWAP = new SWAP();
+    public static final ArithmeticInstruction IADD = new IADD();
+    public static final ArithmeticInstruction LADD = new LADD();
+    public static final ArithmeticInstruction FADD = new FADD();
+    public static final ArithmeticInstruction DADD = new DADD();
+    public static final ArithmeticInstruction ISUB = new ISUB();
+    public static final ArithmeticInstruction LSUB = new LSUB();
+    public static final ArithmeticInstruction FSUB = new FSUB();
+    public static final ArithmeticInstruction DSUB = new DSUB();
+    public static final ArithmeticInstruction IMUL = new IMUL();
+    public static final ArithmeticInstruction LMUL = new LMUL();
+    public static final ArithmeticInstruction FMUL = new FMUL();
+    public static final ArithmeticInstruction DMUL = new DMUL();
+    public static final ArithmeticInstruction IDIV = new IDIV();
+    public static final ArithmeticInstruction LDIV = new LDIV();
+    public static final ArithmeticInstruction FDIV = new FDIV();
+    public static final ArithmeticInstruction DDIV = new DDIV();
+    public static final ArithmeticInstruction IREM = new IREM();
+    public static final ArithmeticInstruction LREM = new LREM();
+    public static final ArithmeticInstruction FREM = new FREM();
+    public static final ArithmeticInstruction DREM = new DREM();
+    public static final ArithmeticInstruction INEG = new INEG();
+    public static final ArithmeticInstruction LNEG = new LNEG();
+    public static final ArithmeticInstruction FNEG = new FNEG();
+    public static final ArithmeticInstruction DNEG = new DNEG();
+    public static final ArithmeticInstruction ISHL = new ISHL();
+    public static final ArithmeticInstruction LSHL = new LSHL();
+    public static final ArithmeticInstruction ISHR = new ISHR();
+    public static final ArithmeticInstruction LSHR = new LSHR();
+    public static final ArithmeticInstruction IUSHR = new IUSHR();
+    public static final ArithmeticInstruction LUSHR = new LUSHR();
+    public static final ArithmeticInstruction IAND = new IAND();
+    public static final ArithmeticInstruction LAND = new LAND();
+    public static final ArithmeticInstruction IOR = new IOR();
+    public static final ArithmeticInstruction LOR = new LOR();
+    public static final ArithmeticInstruction IXOR = new IXOR();
+    public static final ArithmeticInstruction LXOR = new LXOR();
+    public static final ConversionInstruction I2L = new I2L();
+    public static final ConversionInstruction I2F = new I2F();
+    public static final ConversionInstruction I2D = new I2D();
+    public static final ConversionInstruction L2I = new L2I();
+    public static final ConversionInstruction L2F = new L2F();
+    public static final ConversionInstruction L2D = new L2D();
+    public static final ConversionInstruction F2I = new F2I();
+    public static final ConversionInstruction F2L = new F2L();
+    public static final ConversionInstruction F2D = new F2D();
+    public static final ConversionInstruction D2I = new D2I();
+    public static final ConversionInstruction D2L = new D2L();
+    public static final ConversionInstruction D2F = new D2F();
+    public static final ConversionInstruction I2B = new I2B();
+    public static final ConversionInstruction I2C = new I2C();
+    public static final ConversionInstruction I2S = new I2S();
+    public static final Instruction LCMP = new LCMP();
+    public static final Instruction FCMPL = new FCMPL();
+    public static final Instruction FCMPG = new FCMPG();
+    public static final Instruction DCMPL = new DCMPL();
+    public static final Instruction DCMPG = new DCMPG();
+    public static final ReturnInstruction IRETURN = new IRETURN();
+    public static final ReturnInstruction LRETURN = new LRETURN();
+    public static final ReturnInstruction FRETURN = new FRETURN();
+    public static final ReturnInstruction DRETURN = new DRETURN();
+    public static final ReturnInstruction ARETURN = new ARETURN();
+    public static final ReturnInstruction RETURN = new RETURN();
+    public static final Instruction ARRAYLENGTH = new ARRAYLENGTH();
+    public static final Instruction ATHROW = new ATHROW();
+    public static final Instruction MONITORENTER = new MONITORENTER();
+    public static final Instruction MONITOREXIT = new MONITOREXIT();
+    /** You can use these constants in multiple places safely, if you can guarantee
+     * that you will never alter their internal values, e.g. call setIndex().
+     */
+    public static final LocalVariableInstruction THIS = new ALOAD(0);
+    public static final LocalVariableInstruction ALOAD_0 = THIS;
+    public static final LocalVariableInstruction ALOAD_1 = new ALOAD(1);
+    public static final LocalVariableInstruction ALOAD_2 = new ALOAD(2);
+    public static final LocalVariableInstruction ILOAD_0 = new ILOAD(0);
+    public static final LocalVariableInstruction ILOAD_1 = new ILOAD(1);
+    public static final LocalVariableInstruction ILOAD_2 = new ILOAD(2);
+    public static final LocalVariableInstruction ASTORE_0 = new ASTORE(0);
+    public static final LocalVariableInstruction ASTORE_1 = new ASTORE(1);
+    public static final LocalVariableInstruction ASTORE_2 = new ASTORE(2);
+    public static final LocalVariableInstruction ISTORE_0 = new ISTORE(0);
+    public static final LocalVariableInstruction ISTORE_1 = new ISTORE(1);
+    public static final LocalVariableInstruction ISTORE_2 = new ISTORE(2);
+    /** Get object via its opcode, for immutable instructions like
+     * branch instructions entries are set to null.
+     */
+    public static final Instruction[] INSTRUCTIONS = new Instruction[256];
+    /** Interfaces may have no static initializers, so we simulate this
+     * with an inner class.
+     */
+    static final Clinit bla = new Clinit();
 
-  /** Get object via its opcode, for immutable instructions like
-   * branch instructions entries are set to null.
-   */
-  public static final Instruction[] INSTRUCTIONS = new Instruction[256];
-  
-  /** Interfaces may have no static initializers, so we simulate this
-   * with an inner class.
-   */
-  static final Clinit bla = new Clinit();
+    static class Clinit {
 
-  static class Clinit {
-    Clinit() {
-      INSTRUCTIONS[Constants.NOP] = NOP;
-      INSTRUCTIONS[Constants.ACONST_NULL] = ACONST_NULL;
-      INSTRUCTIONS[Constants.ICONST_M1] = ICONST_M1;
-      INSTRUCTIONS[Constants.ICONST_0] = ICONST_0;
-      INSTRUCTIONS[Constants.ICONST_1] = ICONST_1;
-      INSTRUCTIONS[Constants.ICONST_2] = ICONST_2;
-      INSTRUCTIONS[Constants.ICONST_3] = ICONST_3;
-      INSTRUCTIONS[Constants.ICONST_4] = ICONST_4;
-      INSTRUCTIONS[Constants.ICONST_5] = ICONST_5;
-      INSTRUCTIONS[Constants.LCONST_0] = LCONST_0;
-      INSTRUCTIONS[Constants.LCONST_1] = LCONST_1;
-      INSTRUCTIONS[Constants.FCONST_0] = FCONST_0;
-      INSTRUCTIONS[Constants.FCONST_1] = FCONST_1;
-      INSTRUCTIONS[Constants.FCONST_2] = FCONST_2;
-      INSTRUCTIONS[Constants.DCONST_0] = DCONST_0;
-      INSTRUCTIONS[Constants.DCONST_1] = DCONST_1;
-      INSTRUCTIONS[Constants.IALOAD] = IALOAD;
-      INSTRUCTIONS[Constants.LALOAD] = LALOAD;
-      INSTRUCTIONS[Constants.FALOAD] = FALOAD;
-      INSTRUCTIONS[Constants.DALOAD] = DALOAD;
-      INSTRUCTIONS[Constants.AALOAD] = AALOAD;
-      INSTRUCTIONS[Constants.BALOAD] = BALOAD;
-      INSTRUCTIONS[Constants.CALOAD] = CALOAD;
-      INSTRUCTIONS[Constants.SALOAD] = SALOAD;
-      INSTRUCTIONS[Constants.IASTORE] = IASTORE;
-      INSTRUCTIONS[Constants.LASTORE] = LASTORE;
-      INSTRUCTIONS[Constants.FASTORE] = FASTORE;
-      INSTRUCTIONS[Constants.DASTORE] = DASTORE;
-      INSTRUCTIONS[Constants.AASTORE] = AASTORE;
-      INSTRUCTIONS[Constants.BASTORE] = BASTORE;
-      INSTRUCTIONS[Constants.CASTORE] = CASTORE;
-      INSTRUCTIONS[Constants.SASTORE] = SASTORE;
-      INSTRUCTIONS[Constants.POP] = POP;
-      INSTRUCTIONS[Constants.POP2] = POP2;
-      INSTRUCTIONS[Constants.DUP] = DUP;
-      INSTRUCTIONS[Constants.DUP_X1] = DUP_X1;
-      INSTRUCTIONS[Constants.DUP_X2] = DUP_X2;
-      INSTRUCTIONS[Constants.DUP2] = DUP2;
-      INSTRUCTIONS[Constants.DUP2_X1] = DUP2_X1;
-      INSTRUCTIONS[Constants.DUP2_X2] = DUP2_X2;
-      INSTRUCTIONS[Constants.SWAP] = SWAP;
-      INSTRUCTIONS[Constants.IADD] = IADD;
-      INSTRUCTIONS[Constants.LADD] = LADD;
-      INSTRUCTIONS[Constants.FADD] = FADD;
-      INSTRUCTIONS[Constants.DADD] = DADD;
-      INSTRUCTIONS[Constants.ISUB] = ISUB;
-      INSTRUCTIONS[Constants.LSUB] = LSUB;
-      INSTRUCTIONS[Constants.FSUB] = FSUB;
-      INSTRUCTIONS[Constants.DSUB] = DSUB;
-      INSTRUCTIONS[Constants.IMUL] = IMUL;
-      INSTRUCTIONS[Constants.LMUL] = LMUL;
-      INSTRUCTIONS[Constants.FMUL] = FMUL;
-      INSTRUCTIONS[Constants.DMUL] = DMUL;
-      INSTRUCTIONS[Constants.IDIV] = IDIV;
-      INSTRUCTIONS[Constants.LDIV] = LDIV;
-      INSTRUCTIONS[Constants.FDIV] = FDIV;
-      INSTRUCTIONS[Constants.DDIV] = DDIV;
-      INSTRUCTIONS[Constants.IREM] = IREM;
-      INSTRUCTIONS[Constants.LREM] = LREM;
-      INSTRUCTIONS[Constants.FREM] = FREM;
-      INSTRUCTIONS[Constants.DREM] = DREM;
-      INSTRUCTIONS[Constants.INEG] = INEG;
-      INSTRUCTIONS[Constants.LNEG] = LNEG;
-      INSTRUCTIONS[Constants.FNEG] = FNEG;
-      INSTRUCTIONS[Constants.DNEG] = DNEG;
-      INSTRUCTIONS[Constants.ISHL] = ISHL;
-      INSTRUCTIONS[Constants.LSHL] = LSHL;
-      INSTRUCTIONS[Constants.ISHR] = ISHR;
-      INSTRUCTIONS[Constants.LSHR] = LSHR;
-      INSTRUCTIONS[Constants.IUSHR] = IUSHR;
-      INSTRUCTIONS[Constants.LUSHR] = LUSHR;
-      INSTRUCTIONS[Constants.IAND] = IAND;
-      INSTRUCTIONS[Constants.LAND] = LAND;
-      INSTRUCTIONS[Constants.IOR] = IOR;
-      INSTRUCTIONS[Constants.LOR] = LOR;
-      INSTRUCTIONS[Constants.IXOR] = IXOR;
-      INSTRUCTIONS[Constants.LXOR] = LXOR;
-      INSTRUCTIONS[Constants.I2L] = I2L;
-      INSTRUCTIONS[Constants.I2F] = I2F;
-      INSTRUCTIONS[Constants.I2D] = I2D;
-      INSTRUCTIONS[Constants.L2I] = L2I;
-      INSTRUCTIONS[Constants.L2F] = L2F;
-      INSTRUCTIONS[Constants.L2D] = L2D;
-      INSTRUCTIONS[Constants.F2I] = F2I;
-      INSTRUCTIONS[Constants.F2L] = F2L;
-      INSTRUCTIONS[Constants.F2D] = F2D;
-      INSTRUCTIONS[Constants.D2I] = D2I;
-      INSTRUCTIONS[Constants.D2L] = D2L;
-      INSTRUCTIONS[Constants.D2F] = D2F;
-      INSTRUCTIONS[Constants.I2B] = I2B;
-      INSTRUCTIONS[Constants.I2C] = I2C;
-      INSTRUCTIONS[Constants.I2S] = I2S;
-      INSTRUCTIONS[Constants.LCMP] = LCMP;
-      INSTRUCTIONS[Constants.FCMPL] = FCMPL;
-      INSTRUCTIONS[Constants.FCMPG] = FCMPG;
-      INSTRUCTIONS[Constants.DCMPL] = DCMPL;
-      INSTRUCTIONS[Constants.DCMPG] = DCMPG;
-      INSTRUCTIONS[Constants.IRETURN] = IRETURN;
-      INSTRUCTIONS[Constants.LRETURN] = LRETURN;
-      INSTRUCTIONS[Constants.FRETURN] = FRETURN;
-      INSTRUCTIONS[Constants.DRETURN] = DRETURN;
-      INSTRUCTIONS[Constants.ARETURN] = ARETURN;
-      INSTRUCTIONS[Constants.RETURN] = RETURN;
-      INSTRUCTIONS[Constants.ARRAYLENGTH] = ARRAYLENGTH;
-      INSTRUCTIONS[Constants.ATHROW] = ATHROW;
-      INSTRUCTIONS[Constants.MONITORENTER] = MONITORENTER;
-      INSTRUCTIONS[Constants.MONITOREXIT] = MONITOREXIT;
+        Clinit() {
+            INSTRUCTIONS[Constants.NOP] = NOP;
+            INSTRUCTIONS[Constants.ACONST_NULL] = ACONST_NULL;
+            INSTRUCTIONS[Constants.ICONST_M1] = ICONST_M1;
+            INSTRUCTIONS[Constants.ICONST_0] = ICONST_0;
+            INSTRUCTIONS[Constants.ICONST_1] = ICONST_1;
+            INSTRUCTIONS[Constants.ICONST_2] = ICONST_2;
+            INSTRUCTIONS[Constants.ICONST_3] = ICONST_3;
+            INSTRUCTIONS[Constants.ICONST_4] = ICONST_4;
+            INSTRUCTIONS[Constants.ICONST_5] = ICONST_5;
+            INSTRUCTIONS[Constants.LCONST_0] = LCONST_0;
+            INSTRUCTIONS[Constants.LCONST_1] = LCONST_1;
+            INSTRUCTIONS[Constants.FCONST_0] = FCONST_0;
+            INSTRUCTIONS[Constants.FCONST_1] = FCONST_1;
+            INSTRUCTIONS[Constants.FCONST_2] = FCONST_2;
+            INSTRUCTIONS[Constants.DCONST_0] = DCONST_0;
+            INSTRUCTIONS[Constants.DCONST_1] = DCONST_1;
+            INSTRUCTIONS[Constants.IALOAD] = IALOAD;
+            INSTRUCTIONS[Constants.LALOAD] = LALOAD;
+            INSTRUCTIONS[Constants.FALOAD] = FALOAD;
+            INSTRUCTIONS[Constants.DALOAD] = DALOAD;
+            INSTRUCTIONS[Constants.AALOAD] = AALOAD;
+            INSTRUCTIONS[Constants.BALOAD] = BALOAD;
+            INSTRUCTIONS[Constants.CALOAD] = CALOAD;
+            INSTRUCTIONS[Constants.SALOAD] = SALOAD;
+            INSTRUCTIONS[Constants.IASTORE] = IASTORE;
+            INSTRUCTIONS[Constants.LASTORE] = LASTORE;
+            INSTRUCTIONS[Constants.FASTORE] = FASTORE;
+            INSTRUCTIONS[Constants.DASTORE] = DASTORE;
+            INSTRUCTIONS[Constants.AASTORE] = AASTORE;
+            INSTRUCTIONS[Constants.BASTORE] = BASTORE;
+            INSTRUCTIONS[Constants.CASTORE] = CASTORE;
+            INSTRUCTIONS[Constants.SASTORE] = SASTORE;
+            INSTRUCTIONS[Constants.POP] = POP;
+            INSTRUCTIONS[Constants.POP2] = POP2;
+            INSTRUCTIONS[Constants.DUP] = DUP;
+            INSTRUCTIONS[Constants.DUP_X1] = DUP_X1;
+            INSTRUCTIONS[Constants.DUP_X2] = DUP_X2;
+            INSTRUCTIONS[Constants.DUP2] = DUP2;
+            INSTRUCTIONS[Constants.DUP2_X1] = DUP2_X1;
+            INSTRUCTIONS[Constants.DUP2_X2] = DUP2_X2;
+            INSTRUCTIONS[Constants.SWAP] = SWAP;
+            INSTRUCTIONS[Constants.IADD] = IADD;
+            INSTRUCTIONS[Constants.LADD] = LADD;
+            INSTRUCTIONS[Constants.FADD] = FADD;
+            INSTRUCTIONS[Constants.DADD] = DADD;
+            INSTRUCTIONS[Constants.ISUB] = ISUB;
+            INSTRUCTIONS[Constants.LSUB] = LSUB;
+            INSTRUCTIONS[Constants.FSUB] = FSUB;
+            INSTRUCTIONS[Constants.DSUB] = DSUB;
+            INSTRUCTIONS[Constants.IMUL] = IMUL;
+            INSTRUCTIONS[Constants.LMUL] = LMUL;
+            INSTRUCTIONS[Constants.FMUL] = FMUL;
+            INSTRUCTIONS[Constants.DMUL] = DMUL;
+            INSTRUCTIONS[Constants.IDIV] = IDIV;
+            INSTRUCTIONS[Constants.LDIV] = LDIV;
+            INSTRUCTIONS[Constants.FDIV] = FDIV;
+            INSTRUCTIONS[Constants.DDIV] = DDIV;
+            INSTRUCTIONS[Constants.IREM] = IREM;
+            INSTRUCTIONS[Constants.LREM] = LREM;
+            INSTRUCTIONS[Constants.FREM] = FREM;
+            INSTRUCTIONS[Constants.DREM] = DREM;
+            INSTRUCTIONS[Constants.INEG] = INEG;
+            INSTRUCTIONS[Constants.LNEG] = LNEG;
+            INSTRUCTIONS[Constants.FNEG] = FNEG;
+            INSTRUCTIONS[Constants.DNEG] = DNEG;
+            INSTRUCTIONS[Constants.ISHL] = ISHL;
+            INSTRUCTIONS[Constants.LSHL] = LSHL;
+            INSTRUCTIONS[Constants.ISHR] = ISHR;
+            INSTRUCTIONS[Constants.LSHR] = LSHR;
+            INSTRUCTIONS[Constants.IUSHR] = IUSHR;
+            INSTRUCTIONS[Constants.LUSHR] = LUSHR;
+            INSTRUCTIONS[Constants.IAND] = IAND;
+            INSTRUCTIONS[Constants.LAND] = LAND;
+            INSTRUCTIONS[Constants.IOR] = IOR;
+            INSTRUCTIONS[Constants.LOR] = LOR;
+            INSTRUCTIONS[Constants.IXOR] = IXOR;
+            INSTRUCTIONS[Constants.LXOR] = LXOR;
+            INSTRUCTIONS[Constants.I2L] = I2L;
+            INSTRUCTIONS[Constants.I2F] = I2F;
+            INSTRUCTIONS[Constants.I2D] = I2D;
+            INSTRUCTIONS[Constants.L2I] = L2I;
+            INSTRUCTIONS[Constants.L2F] = L2F;
+            INSTRUCTIONS[Constants.L2D] = L2D;
+            INSTRUCTIONS[Constants.F2I] = F2I;
+            INSTRUCTIONS[Constants.F2L] = F2L;
+            INSTRUCTIONS[Constants.F2D] = F2D;
+            INSTRUCTIONS[Constants.D2I] = D2I;
+            INSTRUCTIONS[Constants.D2L] = D2L;
+            INSTRUCTIONS[Constants.D2F] = D2F;
+            INSTRUCTIONS[Constants.I2B] = I2B;
+            INSTRUCTIONS[Constants.I2C] = I2C;
+            INSTRUCTIONS[Constants.I2S] = I2S;
+            INSTRUCTIONS[Constants.LCMP] = LCMP;
+            INSTRUCTIONS[Constants.FCMPL] = FCMPL;
+            INSTRUCTIONS[Constants.FCMPG] = FCMPG;
+            INSTRUCTIONS[Constants.DCMPL] = DCMPL;
+            INSTRUCTIONS[Constants.DCMPG] = DCMPG;
+            INSTRUCTIONS[Constants.IRETURN] = IRETURN;
+            INSTRUCTIONS[Constants.LRETURN] = LRETURN;
+            INSTRUCTIONS[Constants.FRETURN] = FRETURN;
+            INSTRUCTIONS[Constants.DRETURN] = DRETURN;
+            INSTRUCTIONS[Constants.ARETURN] = ARETURN;
+            INSTRUCTIONS[Constants.RETURN] = RETURN;
+            INSTRUCTIONS[Constants.ARRAYLENGTH] = ARRAYLENGTH;
+            INSTRUCTIONS[Constants.ATHROW] = ATHROW;
+            INSTRUCTIONS[Constants.MONITORENTER] = MONITORENTER;
+            INSTRUCTIONS[Constants.MONITOREXIT] = MONITOREXIT;
+        }
     }
-  }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: bcel-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: bcel-dev-help@jakarta.apache.org