svn commit: r386056 [12/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...

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ConstantPoolGen.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ConstantPoolGen.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ConstantPoolGen.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ConstantPoolGen.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.util.HashMap;
 import java.util.Map;
 import org.apache.bcel.Constants;
@@ -50,741 +49,716 @@
  * @see Constant
  */
 public class ConstantPoolGen implements java.io.Serializable {
-  protected int        size      = 1024; // Inital size, sufficient in most cases
-  protected Constant[] constants = new Constant[size];
-  protected int        index     = 1; // First entry (0) used by JVM
-
-  private static final String METHODREF_DELIM  = ":";
-  private static final String IMETHODREF_DELIM = "#";
-  private static final String FIELDREF_DELIM   = "&";
-  private static final String NAT_DELIM        = "%";
-
-  private static class Index implements java.io.Serializable {
-    int index;
-    Index(int i) { index = i; }
-  }
-
-  /**
-   * Initialize with given array of constants.
-   *
-   * @param cs array of given constants, new ones will be appended
-   */
-  public ConstantPoolGen(Constant[] cs) {
-    if(cs.length > size) {
-      size      = cs.length;
-      constants = new Constant[size];
-    }
-
-    System.arraycopy(cs, 0, constants, 0, cs.length);
-
-    if(cs.length > 0)
-      index = cs.length;
-
-    for(int i=1; i < index; i++) {
-      Constant c = constants[i];
-
-      if(c instanceof ConstantString) {
-	ConstantString s  = (ConstantString)c;
-	ConstantUtf8   u8 = (ConstantUtf8)constants[s.getStringIndex()];
-
-    String key = u8.getBytes();
-    if (!string_table.containsKey(key))
-	string_table.put(key, new Index(i));
-      } else if(c instanceof ConstantClass) {
-	ConstantClass s  = (ConstantClass)c;
-	ConstantUtf8  u8 = (ConstantUtf8)constants[s.getNameIndex()];
-
-    String key = u8.getBytes();
-    if (!class_table.containsKey(key))
-	class_table.put(key, new Index(i));
-      } else if(c instanceof ConstantNameAndType) {
-	ConstantNameAndType n    = (ConstantNameAndType)c;
-	ConstantUtf8        u8   = (ConstantUtf8)constants[n.getNameIndex()];
-	ConstantUtf8        u8_2 = (ConstantUtf8)constants[n.getSignatureIndex()];
-
-    String key = u8.getBytes() + NAT_DELIM + u8_2.getBytes();
-    if (!n_a_t_table.containsKey(key))
-	n_a_t_table.put(key, new Index(i));
-       } else if(c instanceof ConstantUtf8) {
-         ConstantUtf8 u = (ConstantUtf8)c;
-         
-         String key = u.getBytes();
-         if (!utf8_table.containsKey(key))
-         utf8_table.put(key, new Index(i));
-      } else if(c instanceof ConstantCP) {
-	ConstantCP          m     = (ConstantCP)c;
-	ConstantClass       clazz = (ConstantClass)constants[m.getClassIndex()];
-	ConstantNameAndType n     = (ConstantNameAndType)constants[m.getNameAndTypeIndex()];
-	
-        ConstantUtf8 u8         = (ConstantUtf8)constants[clazz.getNameIndex()];
-        String       class_name = u8.getBytes().replace('/', '.');
-
-	u8 = (ConstantUtf8)constants[n.getNameIndex()];
-	String method_name = u8.getBytes();
-
-	u8 = (ConstantUtf8)constants[n.getSignatureIndex()];
-	String signature = u8.getBytes();
-
-	String delim = METHODREF_DELIM;
-
-	if(c instanceof ConstantInterfaceMethodref)
-	  delim = IMETHODREF_DELIM;
-	else if(c instanceof ConstantFieldref)
-	  delim = FIELDREF_DELIM;
-
-    String key = class_name + delim + method_name + delim + signature;
-    if (!cp_table.containsKey(key))
-	cp_table.put(key, new Index(i));
-      }
-    }
-  }
-
-  /**
-   * Initialize with given constant pool.
-   */
-  public ConstantPoolGen(ConstantPool cp) {
-    this(cp.getConstantPool());
-  }
-
-  /**
-   * Create empty constant pool.
-   */
-  public ConstantPoolGen() {}
-
-  /** Resize internal array of constants.
-   */
-  protected void adjustSize() {
-    if(index + 3 >= size) {
-      Constant[] cs = constants;
-
-      size      *= 2;
-      constants  = new Constant[size];
-      System.arraycopy(cs, 0, constants, 0, index);
-    }
-  }
-
-  private Map string_table = new HashMap();
-
-  /** 
-   * Look for ConstantString in ConstantPool containing String `str'.
-   *
-   * @param str String to search for
-   * @return index on success, -1 otherwise
-   */
-  public int lookupString(String str) {
-    Index index = (Index)string_table.get(str);
-    return (index != null)? index.index : -1;
-  }
-  
-  /**
-   * Add a new String constant to the ConstantPool, if it is not already in there.
-   *
-   * @param str String to add
-   * @return index of entry
-   */
-  public int addString(String str) {
-    int ret;
-    
-    if((ret = lookupString(str)) != -1)
-      return ret; // Already in CP
-
-    int utf8 = addUtf8(str);
-
-    adjustSize();
-
-    ConstantString s  = new ConstantString(utf8);
-       
-    ret = index;
-    constants[index++] = s;
-
-    if (!string_table.containsKey(str))
-    string_table.put(str, new Index(ret));
-
-    return ret;
-  }
-
-  private Map class_table = new HashMap();
-
-  /**
-   * Look for ConstantClass in ConstantPool named `str'.
-   *
-   * @param str String to search for
-   * @return index on success, -1 otherwise
-   */
-  public int lookupClass(String str) {
-    Index index = (Index)class_table.get(str.replace('.', '/'));
-    return (index != null)? index.index : -1;
-  }
-
-  private int addClass_(String clazz) {
-    int    ret;
-
-    if((ret = lookupClass(clazz)) != -1)
-      return ret; // Already in CP
-
-    adjustSize();
-
-    ConstantClass c = new ConstantClass(addUtf8(clazz));
-
-    ret = index;
-    constants[index++] = c;
-
-    if (!class_table.containsKey(clazz))
-    class_table.put(clazz, new Index(ret));
-
-    return ret;
-  }
-
-  /**
-   * Add a new Class reference to the ConstantPool, if it is not already in there.
-   *
-   * @param str Class to add
-   * @return index of entry
-   */
-  public int addClass(String str) {
-    return addClass_(str.replace('.', '/'));
-  }
-
-  /**
-   * Add a new Class reference to the ConstantPool for a given type.
-   *
-   * @param type Class to add
-   * @return index of entry
-   */
-  public int addClass(ObjectType type) {
-    return addClass(type.getClassName());
-  }
-
-  /**
-   * Add a reference to an array class (e.g. String[][]) as needed by MULTIANEWARRAY
-   * instruction, e.g. to the ConstantPool.
-   *
-   * @param type type of array class
-   * @return index of entry
-   */
-  public int addArrayClass(ArrayType type) {
-    return addClass_(type.getSignature());
-  }
-
-  /** 
-   * Look for ConstantInteger in ConstantPool.
-   *
-   * @param n integer number to look for
-   * @return index on success, -1 otherwise
-   */
-  public int lookupInteger(int n) {
-    for(int i=1; i < index; i++) {
-      if(constants[i] instanceof ConstantInteger) {
-	ConstantInteger c = (ConstantInteger)constants[i];
-
-	if(c.getBytes() == n)
-	  return i;
-      }
-    }
-
-    return -1;
-  }
-
-  /**
-   * Add a new Integer constant to the ConstantPool, if it is not already in there.
-   *
-   * @param n integer number to add
-   * @return index of entry
-   */
-  public int addInteger(int n) {
-    int  ret;
-
-    if((ret = lookupInteger(n)) != -1)
-      return ret; // Already in CP
-
-    adjustSize();
-
-    ret = index;
-    constants[index++] = new ConstantInteger(n);
-
-    return ret;
-  }
-
-  /** 
-   * Look for ConstantFloat in ConstantPool.
-   *
-   * @param n Float number to look for
-   * @return index on success, -1 otherwise
-   */
-  public int lookupFloat(float n) {
-    int bits = Float.floatToIntBits(n);
-
-    for(int i=1; i < index; i++) {
-      if(constants[i] instanceof ConstantFloat) {
-	ConstantFloat c = (ConstantFloat)constants[i];
-
-	if(Float.floatToIntBits(c.getBytes()) == bits)
-	  return i;
-      }
-    }
-
-    return -1;
-  }
-
-  /**
-   * Add a new Float constant to the ConstantPool, if it is not already in there.
-   *
-   * @param n Float number to add
-   * @return index of entry
-   */
-  public int addFloat(float n) {
-    int  ret;
-
-    if((ret = lookupFloat(n)) != -1)
-      return ret; // Already in CP
-
-    adjustSize();
-
-    ret = index;
-    constants[index++] = new ConstantFloat(n);
-
-    return ret;
-  }
-
-  private Map utf8_table = new HashMap();
-
-  /** 
-   * Look for ConstantUtf8 in ConstantPool.
-   *
-   * @param n Utf8 string to look for
-   * @return index on success, -1 otherwise
-   */
-  public int lookupUtf8(String n) {
-    Index index = (Index)utf8_table.get(n);
-
-    return (index != null)? index.index : -1;
-  }
-
-  /**
-   * Add a new Utf8 constant to the ConstantPool, if it is not already in there.
-   *
-   * @param n Utf8 string to add
-   * @return index of entry
-   */
-  public int addUtf8(String n) {
-    int  ret;
-
-    if((ret = lookupUtf8(n)) != -1)
-      return ret; // Already in CP
-
-    adjustSize();
-
-    ret = index;
-    constants[index++] = new ConstantUtf8(n);
-
-    if (!utf8_table.containsKey(n))
-    utf8_table.put(n, new Index(ret));
-
-    return ret;
-  }
-
-  /** 
-   * Look for ConstantLong in ConstantPool.
-   *
-   * @param n Long number to look for
-   * @return index on success, -1 otherwise
-   */
-  public int lookupLong(long n) {
-    for(int i=1; i < index; i++) {
-      if(constants[i] instanceof ConstantLong) {
-	ConstantLong c = (ConstantLong)constants[i];
-
-	if(c.getBytes() == n)
-	  return i;
-      }
-    }
-
-    return -1;
-  }
-
-  /**
-   * Add a new long constant to the ConstantPool, if it is not already in there.
-   *
-   * @param n Long number to add
-   * @return index of entry
-   */
-  public int addLong(long n) {
-    int  ret;
-
-    if((ret = lookupLong(n)) != -1)
-      return ret; // Already in CP
-
-    adjustSize();
-
-    ret = index;
-    constants[index] = new ConstantLong(n);
-    index += 2;   // Wastes one entry according to spec
-
-    return ret;
-  }
-
-  /** 
-   * Look for ConstantDouble in ConstantPool.
-   *
-   * @param n Double number to look for
-   * @return index on success, -1 otherwise
-   */
-  public int lookupDouble(double n) {
-    long bits = Double.doubleToLongBits(n);
-
-    for(int i=1; i < index; i++) {
-      if(constants[i] instanceof ConstantDouble) {
-	ConstantDouble c = (ConstantDouble)constants[i];
-	
-	if(Double.doubleToLongBits(c.getBytes()) == bits)
-	  return i;
-      }
-    }
-
-    return -1;
-  }
-
-  /**
-   * Add a new double constant to the ConstantPool, if it is not already in there.
-   *
-   * @param n Double number to add
-   * @return index of entry
-   */
-  public int addDouble(double n) {
-    int  ret;
-
-    if((ret = lookupDouble(n)) != -1)
-      return ret; // Already in CP
-
-    adjustSize();
-
-    ret = index;
-    constants[index] = new ConstantDouble(n);
-    index += 2;   // Wastes one entry according to spec
-
-    return ret;
-  }
-
-  private Map n_a_t_table = new HashMap();
-
-  /** 
-   * Look for ConstantNameAndType in ConstantPool.
-   *
-   * @param name of variable/method
-   * @param signature of variable/method
-   * @return index on success, -1 otherwise
-   */
-  public int lookupNameAndType(String name, String signature) {
-    Index _index = (Index)n_a_t_table.get(name + NAT_DELIM + signature);
-    return (_index != null)? _index.index : -1;
-  }
-
-  /**
-   * Add a new NameAndType constant to the ConstantPool if it is not already 
-   * in there.
-   *
-   * @param name Name string to add
-   * @param signature signature string to add
-   * @return index of entry
-   */
-  public int addNameAndType(String name, String signature) {
-    int  ret;
-    int  name_index, signature_index;
-
-    if((ret = lookupNameAndType(name, signature)) != -1)
-      return ret; // Already in CP
-
-    adjustSize();
-
-    name_index      = addUtf8(name);
-    signature_index = addUtf8(signature);
-    ret = index;
-    constants[index++] = new ConstantNameAndType(name_index, signature_index);
-
-    String key = name + NAT_DELIM + signature;
-    if (!n_a_t_table.containsKey(key))
-    n_a_t_table.put(key, new Index(ret));
-    return ret;
-  }
-
-  private Map cp_table = new HashMap();
-
-  /** 
-   * Look for ConstantMethodref in ConstantPool.
-   *
-   * @param class_name Where to find method
-   * @param method_name Guess what
-   * @param signature return and argument types
-   * @return index on success, -1 otherwise
-   */
-  public int lookupMethodref(String class_name, String method_name, String signature) {
-    Index index = (Index)cp_table.get(class_name + METHODREF_DELIM + method_name +
-				      METHODREF_DELIM + signature);
-    return (index != null)? index.index : -1;
-  }
-
-  public int lookupMethodref(MethodGen method) {
-    return lookupMethodref(method.getClassName(), method.getName(),
-			  method.getSignature());
-  }
-
-  /**
-   * Add a new Methodref constant to the ConstantPool, if it is not already 
-   * in there.
-   *
-   * @param class_name class name string to add
-   * @param method_name method name string to add
-   * @param signature method signature string to add
-   * @return index of entry
-   */
-  public int addMethodref(String class_name, String method_name, String signature) {
-    int  ret, class_index, name_and_type_index;
-
-    if((ret = lookupMethodref(class_name, method_name, signature)) != -1)
-      return ret; // Already in CP
-
-    adjustSize();
-
-    name_and_type_index = addNameAndType(method_name, signature);
-    class_index         = addClass(class_name);
-    ret = index;
-    constants[index++] = new ConstantMethodref(class_index, name_and_type_index);
-
-    String key = class_name + METHODREF_DELIM + method_name + METHODREF_DELIM + signature;
-    
-    if (!cp_table.containsKey(key))
-    cp_table.put(key, new Index(ret));
-
-    return ret;
-  }
-
-  public int addMethodref(MethodGen method) {
-    return addMethodref(method.getClassName(), method.getName(),
-			method.getSignature());
-  }
-
-  /** 
-   * Look for ConstantInterfaceMethodref in ConstantPool.
-   *
-   * @param class_name Where to find method
-   * @param method_name Guess what
-   * @param signature return and argument types
-   * @return index on success, -1 otherwise
-   */
-  public int lookupInterfaceMethodref(String class_name, String method_name, String signature) {
-    Index index = (Index)cp_table.get(class_name + IMETHODREF_DELIM + method_name +
-				      IMETHODREF_DELIM + signature);
-    return (index != null)? index.index : -1;
-  }
-
-  public int lookupInterfaceMethodref(MethodGen method) {
-    return lookupInterfaceMethodref(method.getClassName(), method.getName(),
-				    method.getSignature());
-  }
-
-  /**
-   * Add a new InterfaceMethodref constant to the ConstantPool, if it is not already 
-   * in there.
-   *
-   * @param class_name class name string to add
-   * @param method_name method name string to add
-   * @param signature signature string to add
-   * @return index of entry
-   */
-  public int addInterfaceMethodref(String class_name, String method_name, String signature) {
-    int ret, class_index, name_and_type_index;
-
-    if((ret = lookupInterfaceMethodref(class_name, method_name, signature)) != -1)
-      return ret; // Already in CP
-
-    adjustSize();
-
-    class_index         = addClass(class_name);
-    name_and_type_index = addNameAndType(method_name, signature);
-    ret = index;
-    constants[index++] = new ConstantInterfaceMethodref(class_index, name_and_type_index);
-
-    String key = class_name + IMETHODREF_DELIM + method_name + IMETHODREF_DELIM + signature;
-    if (!cp_table.containsKey(key))
-    cp_table.put(key, new Index(ret));
-
-    return ret;
-  }
-
-  public int addInterfaceMethodref(MethodGen method) {
-    return addInterfaceMethodref(method.getClassName(), method.getName(),
-				 method.getSignature());
-  }
-
-  /** 
-   * Look for ConstantFieldref in ConstantPool.
-   *
-   * @param class_name Where to find method
-   * @param field_name Guess what
-   * @param signature return and argument types
-   * @return index on success, -1 otherwise
-   */
-  public int lookupFieldref(String class_name, String field_name, String signature) {
-    Index index = (Index)cp_table.get(class_name + FIELDREF_DELIM + field_name +
-				      FIELDREF_DELIM + signature);
-    return (index != null)? index.index : -1;
-  }
-
-  /**
-   * Add a new Fieldref constant to the ConstantPool, if it is not already 
-   * in there.
-   *
-   * @param class_name class name string to add
-   * @param field_name field name string to add
-   * @param signature signature string to add
-   * @return index of entry
-   */
-  public int addFieldref(String class_name, String field_name, String signature) {
-    int  ret;
-    int  class_index, name_and_type_index;
-
-    if((ret = lookupFieldref(class_name, field_name, signature)) != -1)
-      return ret; // Already in CP
-
-    adjustSize();
-
-    class_index         = addClass(class_name);
-    name_and_type_index = addNameAndType(field_name, signature);
-    ret = index;
-    constants[index++] = new ConstantFieldref(class_index, name_and_type_index);
-
-    String key = class_name + FIELDREF_DELIM + field_name + FIELDREF_DELIM + signature;
-    if (!cp_table.containsKey(key))
-    cp_table.put(key, new Index(ret));
-
-    return ret;
-  }
-
-  /**
-   * @param i index in constant pool
-   * @return constant pool entry at index i
-   */
-  public Constant getConstant(int i) { return constants[i]; }
-
-  /**
-   * Use with care!
-   *
-   * @param i index in constant pool
-   * @param c new constant pool entry at index i
-   */
-  public void setConstant(int i, Constant c) { constants[i] = c; }
-
-  /**
-   * @return intermediate constant pool
-   */
-  public ConstantPool getConstantPool() {
-    return new ConstantPool(constants);
-  }
-
-  /**
-   * @return current size of constant pool
-   */
-  public int getSize() {
-    return index;
-  }
-
-  /**
-   * @return constant pool with proper length
-   */
-  public ConstantPool getFinalConstantPool() { 
-    Constant[] cs = new Constant[index];
-    
-    System.arraycopy(constants, 0, cs, 0, index);
-
-    return new ConstantPool(cs); 
-  }
-
-  /**
-   * @return String representation.
-   */
-  public String toString() {
-    StringBuffer buf = new StringBuffer();
-
-    for(int i=1; i < index; i++)
-      buf.append(i).append(")").append(constants[i]).append("\n");
-
-    return buf.toString();
-  }
-
-  /** Import constant from another ConstantPool and return new index.
-   */
-  public int addConstant(Constant c, ConstantPoolGen cp) {
-    Constant[] constants = cp.getConstantPool().getConstantPool();
-
-    switch(c.getTag()) {
-    case Constants.CONSTANT_String: {
-      ConstantString s  = (ConstantString)c;
-      ConstantUtf8   u8 = (ConstantUtf8)constants[s.getStringIndex()];
-
-      return addString(u8.getBytes());
-    }
-
-    case Constants.CONSTANT_Class: {
-      ConstantClass s  = (ConstantClass)c;
-      ConstantUtf8  u8 = (ConstantUtf8)constants[s.getNameIndex()];
-
-      return addClass(u8.getBytes());
-    }
-
-    case Constants.CONSTANT_NameAndType: {
-      ConstantNameAndType n    = (ConstantNameAndType)c;
-      ConstantUtf8        u8   = (ConstantUtf8)constants[n.getNameIndex()];
-      ConstantUtf8        u8_2 = (ConstantUtf8)constants[n.getSignatureIndex()];
-
-      return addNameAndType(u8.getBytes(), u8_2.getBytes());
-    }
-
-    case Constants.CONSTANT_Utf8:
-      return addUtf8(((ConstantUtf8)c).getBytes());
-
-    case Constants.CONSTANT_Double:
-      return addDouble(((ConstantDouble)c).getBytes());
-
-    case Constants.CONSTANT_Float:
-      return addFloat(((ConstantFloat)c).getBytes());
-
-    case Constants.CONSTANT_Long:
-      return addLong(((ConstantLong)c).getBytes());
-
-    case Constants.CONSTANT_Integer:
-      return addInteger(((ConstantInteger)c).getBytes());
-
-    case Constants.CONSTANT_InterfaceMethodref: case Constants.CONSTANT_Methodref:
-    case Constants.CONSTANT_Fieldref: {
-      ConstantCP          m     = (ConstantCP)c;
-      ConstantClass       clazz = (ConstantClass)constants[m.getClassIndex()];
-      ConstantNameAndType n     = (ConstantNameAndType)constants[m.getNameAndTypeIndex()];
-      ConstantUtf8 u8           = (ConstantUtf8)constants[clazz.getNameIndex()];
-      String       class_name   = u8.getBytes().replace('/', '.');
-
-      u8 = (ConstantUtf8)constants[n.getNameIndex()];
-      String name = u8.getBytes();
-
-      u8 = (ConstantUtf8)constants[n.getSignatureIndex()];
-      String signature = u8.getBytes();
-
-      switch(c.getTag()) {
-      case Constants.CONSTANT_InterfaceMethodref:
-	return addInterfaceMethodref(class_name, name, signature);
-
-      case Constants.CONSTANT_Methodref:
-	return addMethodref(class_name, name, signature);
-
-      case Constants.CONSTANT_Fieldref:
-	return addFieldref(class_name, name, signature);
-
-      default: // Never reached
-	throw new RuntimeException("Unknown constant type " + c);
-      }
-    }
 
-    default: // Never reached
-      throw new RuntimeException("Unknown constant type " + c);
+    protected int size = 1024; // Inital size, sufficient in most cases
+    protected Constant[] constants = new Constant[size];
+    protected int index = 1; // First entry (0) used by JVM
+    private static final String METHODREF_DELIM = ":";
+    private static final String IMETHODREF_DELIM = "#";
+    private static final String FIELDREF_DELIM = "&";
+    private static final String NAT_DELIM = "%";
+
+    private static class Index implements java.io.Serializable {
+
+        int index;
+
+
+        Index(int i) {
+            index = i;
+        }
+    }
+
+
+    /**
+     * Initialize with given array of constants.
+     *
+     * @param cs array of given constants, new ones will be appended
+     */
+    public ConstantPoolGen(Constant[] cs) {
+        if (cs.length > size) {
+            size = cs.length;
+            constants = new Constant[size];
+        }
+        System.arraycopy(cs, 0, constants, 0, cs.length);
+        if (cs.length > 0) {
+            index = cs.length;
+        }
+        for (int i = 1; i < index; i++) {
+            Constant c = constants[i];
+            if (c instanceof ConstantString) {
+                ConstantString s = (ConstantString) c;
+                ConstantUtf8 u8 = (ConstantUtf8) constants[s.getStringIndex()];
+                String key = u8.getBytes();
+                if (!string_table.containsKey(key)) {
+                    string_table.put(key, new Index(i));
+                }
+            } else if (c instanceof ConstantClass) {
+                ConstantClass s = (ConstantClass) c;
+                ConstantUtf8 u8 = (ConstantUtf8) constants[s.getNameIndex()];
+                String key = u8.getBytes();
+                if (!class_table.containsKey(key)) {
+                    class_table.put(key, new Index(i));
+                }
+            } else if (c instanceof ConstantNameAndType) {
+                ConstantNameAndType n = (ConstantNameAndType) c;
+                ConstantUtf8 u8 = (ConstantUtf8) constants[n.getNameIndex()];
+                ConstantUtf8 u8_2 = (ConstantUtf8) constants[n.getSignatureIndex()];
+                String key = u8.getBytes() + NAT_DELIM + u8_2.getBytes();
+                if (!n_a_t_table.containsKey(key)) {
+                    n_a_t_table.put(key, new Index(i));
+                }
+            } else if (c instanceof ConstantUtf8) {
+                ConstantUtf8 u = (ConstantUtf8) c;
+                String key = u.getBytes();
+                if (!utf8_table.containsKey(key)) {
+                    utf8_table.put(key, new Index(i));
+                }
+            } else if (c instanceof ConstantCP) {
+                ConstantCP m = (ConstantCP) c;
+                ConstantClass clazz = (ConstantClass) constants[m.getClassIndex()];
+                ConstantNameAndType n = (ConstantNameAndType) constants[m.getNameAndTypeIndex()];
+                ConstantUtf8 u8 = (ConstantUtf8) constants[clazz.getNameIndex()];
+                String class_name = u8.getBytes().replace('/', '.');
+                u8 = (ConstantUtf8) constants[n.getNameIndex()];
+                String method_name = u8.getBytes();
+                u8 = (ConstantUtf8) constants[n.getSignatureIndex()];
+                String signature = u8.getBytes();
+                String delim = METHODREF_DELIM;
+                if (c instanceof ConstantInterfaceMethodref) {
+                    delim = IMETHODREF_DELIM;
+                } else if (c instanceof ConstantFieldref) {
+                    delim = FIELDREF_DELIM;
+                }
+                String key = class_name + delim + method_name + delim + signature;
+                if (!cp_table.containsKey(key)) {
+                    cp_table.put(key, new Index(i));
+                }
+            }
+        }
+    }
+
+
+    /**
+     * Initialize with given constant pool.
+     */
+    public ConstantPoolGen(ConstantPool cp) {
+        this(cp.getConstantPool());
+    }
+
+
+    /**
+     * Create empty constant pool.
+     */
+    public ConstantPoolGen() {
+    }
+
+
+    /** Resize internal array of constants.
+     */
+    protected void adjustSize() {
+        if (index + 3 >= size) {
+            Constant[] cs = constants;
+            size *= 2;
+            constants = new Constant[size];
+            System.arraycopy(cs, 0, constants, 0, index);
+        }
+    }
+
+    private Map string_table = new HashMap();
+
+
+    /** 
+     * Look for ConstantString in ConstantPool containing String `str'.
+     *
+     * @param str String to search for
+     * @return index on success, -1 otherwise
+     */
+    public int lookupString( String str ) {
+        Index index = (Index) string_table.get(str);
+        return (index != null) ? index.index : -1;
+    }
+
+
+    /**
+     * Add a new String constant to the ConstantPool, if it is not already in there.
+     *
+     * @param str String to add
+     * @return index of entry
+     */
+    public int addString( String str ) {
+        int ret;
+        if ((ret = lookupString(str)) != -1) {
+            return ret; // Already in CP
+        }
+        int utf8 = addUtf8(str);
+        adjustSize();
+        ConstantString s = new ConstantString(utf8);
+        ret = index;
+        constants[index++] = s;
+        if (!string_table.containsKey(str)) {
+            string_table.put(str, new Index(ret));
+        }
+        return ret;
+    }
+
+    private Map class_table = new HashMap();
+
+
+    /**
+     * Look for ConstantClass in ConstantPool named `str'.
+     *
+     * @param str String to search for
+     * @return index on success, -1 otherwise
+     */
+    public int lookupClass( String str ) {
+        Index index = (Index) class_table.get(str.replace('.', '/'));
+        return (index != null) ? index.index : -1;
+    }
+
+
+    private int addClass_( String clazz ) {
+        int ret;
+        if ((ret = lookupClass(clazz)) != -1) {
+            return ret; // Already in CP
+        }
+        adjustSize();
+        ConstantClass c = new ConstantClass(addUtf8(clazz));
+        ret = index;
+        constants[index++] = c;
+        if (!class_table.containsKey(clazz)) {
+            class_table.put(clazz, new Index(ret));
+        }
+        return ret;
+    }
+
+
+    /**
+     * Add a new Class reference to the ConstantPool, if it is not already in there.
+     *
+     * @param str Class to add
+     * @return index of entry
+     */
+    public int addClass( String str ) {
+        return addClass_(str.replace('.', '/'));
+    }
+
+
+    /**
+     * Add a new Class reference to the ConstantPool for a given type.
+     *
+     * @param type Class to add
+     * @return index of entry
+     */
+    public int addClass( ObjectType type ) {
+        return addClass(type.getClassName());
+    }
+
+
+    /**
+     * Add a reference to an array class (e.g. String[][]) as needed by MULTIANEWARRAY
+     * instruction, e.g. to the ConstantPool.
+     *
+     * @param type type of array class
+     * @return index of entry
+     */
+    public int addArrayClass( ArrayType type ) {
+        return addClass_(type.getSignature());
+    }
+
+
+    /** 
+     * Look for ConstantInteger in ConstantPool.
+     *
+     * @param n integer number to look for
+     * @return index on success, -1 otherwise
+     */
+    public int lookupInteger( int n ) {
+        for (int i = 1; i < index; i++) {
+            if (constants[i] instanceof ConstantInteger) {
+                ConstantInteger c = (ConstantInteger) constants[i];
+                if (c.getBytes() == n) {
+                    return i;
+                }
+            }
+        }
+        return -1;
+    }
+
+
+    /**
+     * Add a new Integer constant to the ConstantPool, if it is not already in there.
+     *
+     * @param n integer number to add
+     * @return index of entry
+     */
+    public int addInteger( int n ) {
+        int ret;
+        if ((ret = lookupInteger(n)) != -1) {
+            return ret; // Already in CP
+        }
+        adjustSize();
+        ret = index;
+        constants[index++] = new ConstantInteger(n);
+        return ret;
+    }
+
+
+    /** 
+     * Look for ConstantFloat in ConstantPool.
+     *
+     * @param n Float number to look for
+     * @return index on success, -1 otherwise
+     */
+    public int lookupFloat( float n ) {
+        int bits = Float.floatToIntBits(n);
+        for (int i = 1; i < index; i++) {
+            if (constants[i] instanceof ConstantFloat) {
+                ConstantFloat c = (ConstantFloat) constants[i];
+                if (Float.floatToIntBits(c.getBytes()) == bits) {
+                    return i;
+                }
+            }
+        }
+        return -1;
+    }
+
+
+    /**
+     * Add a new Float constant to the ConstantPool, if it is not already in there.
+     *
+     * @param n Float number to add
+     * @return index of entry
+     */
+    public int addFloat( float n ) {
+        int ret;
+        if ((ret = lookupFloat(n)) != -1) {
+            return ret; // Already in CP
+        }
+        adjustSize();
+        ret = index;
+        constants[index++] = new ConstantFloat(n);
+        return ret;
+    }
+
+    private Map utf8_table = new HashMap();
+
+
+    /** 
+     * Look for ConstantUtf8 in ConstantPool.
+     *
+     * @param n Utf8 string to look for
+     * @return index on success, -1 otherwise
+     */
+    public int lookupUtf8( String n ) {
+        Index index = (Index) utf8_table.get(n);
+        return (index != null) ? index.index : -1;
+    }
+
+
+    /**
+     * Add a new Utf8 constant to the ConstantPool, if it is not already in there.
+     *
+     * @param n Utf8 string to add
+     * @return index of entry
+     */
+    public int addUtf8( String n ) {
+        int ret;
+        if ((ret = lookupUtf8(n)) != -1) {
+            return ret; // Already in CP
+        }
+        adjustSize();
+        ret = index;
+        constants[index++] = new ConstantUtf8(n);
+        if (!utf8_table.containsKey(n)) {
+            utf8_table.put(n, new Index(ret));
+        }
+        return ret;
+    }
+
+
+    /** 
+     * Look for ConstantLong in ConstantPool.
+     *
+     * @param n Long number to look for
+     * @return index on success, -1 otherwise
+     */
+    public int lookupLong( long n ) {
+        for (int i = 1; i < index; i++) {
+            if (constants[i] instanceof ConstantLong) {
+                ConstantLong c = (ConstantLong) constants[i];
+                if (c.getBytes() == n) {
+                    return i;
+                }
+            }
+        }
+        return -1;
+    }
+
+
+    /**
+     * Add a new long constant to the ConstantPool, if it is not already in there.
+     *
+     * @param n Long number to add
+     * @return index of entry
+     */
+    public int addLong( long n ) {
+        int ret;
+        if ((ret = lookupLong(n)) != -1) {
+            return ret; // Already in CP
+        }
+        adjustSize();
+        ret = index;
+        constants[index] = new ConstantLong(n);
+        index += 2; // Wastes one entry according to spec
+        return ret;
+    }
+
+
+    /** 
+     * Look for ConstantDouble in ConstantPool.
+     *
+     * @param n Double number to look for
+     * @return index on success, -1 otherwise
+     */
+    public int lookupDouble( double n ) {
+        long bits = Double.doubleToLongBits(n);
+        for (int i = 1; i < index; i++) {
+            if (constants[i] instanceof ConstantDouble) {
+                ConstantDouble c = (ConstantDouble) constants[i];
+                if (Double.doubleToLongBits(c.getBytes()) == bits) {
+                    return i;
+                }
+            }
+        }
+        return -1;
+    }
+
+
+    /**
+     * Add a new double constant to the ConstantPool, if it is not already in there.
+     *
+     * @param n Double number to add
+     * @return index of entry
+     */
+    public int addDouble( double n ) {
+        int ret;
+        if ((ret = lookupDouble(n)) != -1) {
+            return ret; // Already in CP
+        }
+        adjustSize();
+        ret = index;
+        constants[index] = new ConstantDouble(n);
+        index += 2; // Wastes one entry according to spec
+        return ret;
+    }
+
+    private Map n_a_t_table = new HashMap();
+
+
+    /** 
+     * Look for ConstantNameAndType in ConstantPool.
+     *
+     * @param name of variable/method
+     * @param signature of variable/method
+     * @return index on success, -1 otherwise
+     */
+    public int lookupNameAndType( String name, String signature ) {
+        Index _index = (Index) n_a_t_table.get(name + NAT_DELIM + signature);
+        return (_index != null) ? _index.index : -1;
+    }
+
+
+    /**
+     * Add a new NameAndType constant to the ConstantPool if it is not already 
+     * in there.
+     *
+     * @param name Name string to add
+     * @param signature signature string to add
+     * @return index of entry
+     */
+    public int addNameAndType( String name, String signature ) {
+        int ret;
+        int name_index, signature_index;
+        if ((ret = lookupNameAndType(name, signature)) != -1) {
+            return ret; // Already in CP
+        }
+        adjustSize();
+        name_index = addUtf8(name);
+        signature_index = addUtf8(signature);
+        ret = index;
+        constants[index++] = new ConstantNameAndType(name_index, signature_index);
+        String key = name + NAT_DELIM + signature;
+        if (!n_a_t_table.containsKey(key)) {
+            n_a_t_table.put(key, new Index(ret));
+        }
+        return ret;
+    }
+
+    private Map cp_table = new HashMap();
+
+
+    /** 
+     * Look for ConstantMethodref in ConstantPool.
+     *
+     * @param class_name Where to find method
+     * @param method_name Guess what
+     * @param signature return and argument types
+     * @return index on success, -1 otherwise
+     */
+    public int lookupMethodref( String class_name, String method_name, String signature ) {
+        Index index = (Index) cp_table.get(class_name + METHODREF_DELIM + method_name
+                + METHODREF_DELIM + signature);
+        return (index != null) ? index.index : -1;
+    }
+
+
+    public int lookupMethodref( MethodGen method ) {
+        return lookupMethodref(method.getClassName(), method.getName(), method.getSignature());
+    }
+
+
+    /**
+     * Add a new Methodref constant to the ConstantPool, if it is not already 
+     * in there.
+     *
+     * @param class_name class name string to add
+     * @param method_name method name string to add
+     * @param signature method signature string to add
+     * @return index of entry
+     */
+    public int addMethodref( String class_name, String method_name, String signature ) {
+        int ret, class_index, name_and_type_index;
+        if ((ret = lookupMethodref(class_name, method_name, signature)) != -1) {
+            return ret; // Already in CP
+        }
+        adjustSize();
+        name_and_type_index = addNameAndType(method_name, signature);
+        class_index = addClass(class_name);
+        ret = index;
+        constants[index++] = new ConstantMethodref(class_index, name_and_type_index);
+        String key = class_name + METHODREF_DELIM + method_name + METHODREF_DELIM + signature;
+        if (!cp_table.containsKey(key)) {
+            cp_table.put(key, new Index(ret));
+        }
+        return ret;
+    }
+
+
+    public int addMethodref( MethodGen method ) {
+        return addMethodref(method.getClassName(), method.getName(), method.getSignature());
+    }
+
+
+    /** 
+     * Look for ConstantInterfaceMethodref in ConstantPool.
+     *
+     * @param class_name Where to find method
+     * @param method_name Guess what
+     * @param signature return and argument types
+     * @return index on success, -1 otherwise
+     */
+    public int lookupInterfaceMethodref( String class_name, String method_name, String signature ) {
+        Index index = (Index) cp_table.get(class_name + IMETHODREF_DELIM + method_name
+                + IMETHODREF_DELIM + signature);
+        return (index != null) ? index.index : -1;
+    }
+
+
+    public int lookupInterfaceMethodref( MethodGen method ) {
+        return lookupInterfaceMethodref(method.getClassName(), method.getName(), method
+                .getSignature());
+    }
+
+
+    /**
+     * Add a new InterfaceMethodref constant to the ConstantPool, if it is not already 
+     * in there.
+     *
+     * @param class_name class name string to add
+     * @param method_name method name string to add
+     * @param signature signature string to add
+     * @return index of entry
+     */
+    public int addInterfaceMethodref( String class_name, String method_name, String signature ) {
+        int ret, class_index, name_and_type_index;
+        if ((ret = lookupInterfaceMethodref(class_name, method_name, signature)) != -1) {
+            return ret; // Already in CP
+        }
+        adjustSize();
+        class_index = addClass(class_name);
+        name_and_type_index = addNameAndType(method_name, signature);
+        ret = index;
+        constants[index++] = new ConstantInterfaceMethodref(class_index, name_and_type_index);
+        String key = class_name + IMETHODREF_DELIM + method_name + IMETHODREF_DELIM + signature;
+        if (!cp_table.containsKey(key)) {
+            cp_table.put(key, new Index(ret));
+        }
+        return ret;
+    }
+
+
+    public int addInterfaceMethodref( MethodGen method ) {
+        return addInterfaceMethodref(method.getClassName(), method.getName(), method.getSignature());
+    }
+
+
+    /** 
+     * Look for ConstantFieldref in ConstantPool.
+     *
+     * @param class_name Where to find method
+     * @param field_name Guess what
+     * @param signature return and argument types
+     * @return index on success, -1 otherwise
+     */
+    public int lookupFieldref( String class_name, String field_name, String signature ) {
+        Index index = (Index) cp_table.get(class_name + FIELDREF_DELIM + field_name
+                + FIELDREF_DELIM + signature);
+        return (index != null) ? index.index : -1;
+    }
+
+
+    /**
+     * Add a new Fieldref constant to the ConstantPool, if it is not already 
+     * in there.
+     *
+     * @param class_name class name string to add
+     * @param field_name field name string to add
+     * @param signature signature string to add
+     * @return index of entry
+     */
+    public int addFieldref( String class_name, String field_name, String signature ) {
+        int ret;
+        int class_index, name_and_type_index;
+        if ((ret = lookupFieldref(class_name, field_name, signature)) != -1) {
+            return ret; // Already in CP
+        }
+        adjustSize();
+        class_index = addClass(class_name);
+        name_and_type_index = addNameAndType(field_name, signature);
+        ret = index;
+        constants[index++] = new ConstantFieldref(class_index, name_and_type_index);
+        String key = class_name + FIELDREF_DELIM + field_name + FIELDREF_DELIM + signature;
+        if (!cp_table.containsKey(key)) {
+            cp_table.put(key, new Index(ret));
+        }
+        return ret;
+    }
+
+
+    /**
+     * @param i index in constant pool
+     * @return constant pool entry at index i
+     */
+    public Constant getConstant( int i ) {
+        return constants[i];
+    }
+
+
+    /**
+     * Use with care!
+     *
+     * @param i index in constant pool
+     * @param c new constant pool entry at index i
+     */
+    public void setConstant( int i, Constant c ) {
+        constants[i] = c;
+    }
+
+
+    /**
+     * @return intermediate constant pool
+     */
+    public ConstantPool getConstantPool() {
+        return new ConstantPool(constants);
+    }
+
+
+    /**
+     * @return current size of constant pool
+     */
+    public int getSize() {
+        return index;
+    }
+
+
+    /**
+     * @return constant pool with proper length
+     */
+    public ConstantPool getFinalConstantPool() {
+        Constant[] cs = new Constant[index];
+        System.arraycopy(constants, 0, cs, 0, index);
+        return new ConstantPool(cs);
+    }
+
+
+    /**
+     * @return String representation.
+     */
+    public String toString() {
+        StringBuffer buf = new StringBuffer();
+        for (int i = 1; i < index; i++) {
+            buf.append(i).append(")").append(constants[i]).append("\n");
+        }
+        return buf.toString();
+    }
+
+
+    /** Import constant from another ConstantPool and return new index.
+     */
+    public int addConstant( Constant c, ConstantPoolGen cp ) {
+        Constant[] constants = cp.getConstantPool().getConstantPool();
+        switch (c.getTag()) {
+            case Constants.CONSTANT_String: {
+                ConstantString s = (ConstantString) c;
+                ConstantUtf8 u8 = (ConstantUtf8) constants[s.getStringIndex()];
+                return addString(u8.getBytes());
+            }
+            case Constants.CONSTANT_Class: {
+                ConstantClass s = (ConstantClass) c;
+                ConstantUtf8 u8 = (ConstantUtf8) constants[s.getNameIndex()];
+                return addClass(u8.getBytes());
+            }
+            case Constants.CONSTANT_NameAndType: {
+                ConstantNameAndType n = (ConstantNameAndType) c;
+                ConstantUtf8 u8 = (ConstantUtf8) constants[n.getNameIndex()];
+                ConstantUtf8 u8_2 = (ConstantUtf8) constants[n.getSignatureIndex()];
+                return addNameAndType(u8.getBytes(), u8_2.getBytes());
+            }
+            case Constants.CONSTANT_Utf8:
+                return addUtf8(((ConstantUtf8) c).getBytes());
+            case Constants.CONSTANT_Double:
+                return addDouble(((ConstantDouble) c).getBytes());
+            case Constants.CONSTANT_Float:
+                return addFloat(((ConstantFloat) c).getBytes());
+            case Constants.CONSTANT_Long:
+                return addLong(((ConstantLong) c).getBytes());
+            case Constants.CONSTANT_Integer:
+                return addInteger(((ConstantInteger) c).getBytes());
+            case Constants.CONSTANT_InterfaceMethodref:
+            case Constants.CONSTANT_Methodref:
+            case Constants.CONSTANT_Fieldref: {
+                ConstantCP m = (ConstantCP) c;
+                ConstantClass clazz = (ConstantClass) constants[m.getClassIndex()];
+                ConstantNameAndType n = (ConstantNameAndType) constants[m.getNameAndTypeIndex()];
+                ConstantUtf8 u8 = (ConstantUtf8) constants[clazz.getNameIndex()];
+                String class_name = u8.getBytes().replace('/', '.');
+                u8 = (ConstantUtf8) constants[n.getNameIndex()];
+                String name = u8.getBytes();
+                u8 = (ConstantUtf8) constants[n.getSignatureIndex()];
+                String signature = u8.getBytes();
+                switch (c.getTag()) {
+                    case Constants.CONSTANT_InterfaceMethodref:
+                        return addInterfaceMethodref(class_name, name, signature);
+                    case Constants.CONSTANT_Methodref:
+                        return addMethodref(class_name, name, signature);
+                    case Constants.CONSTANT_Fieldref:
+                        return addFieldref(class_name, name, signature);
+                    default: // Never reached
+                        throw new RuntimeException("Unknown constant type " + c);
+                }
+            }
+            default: // Never reached
+                throw new RuntimeException("Unknown constant type " + c);
+        }
     }
-  }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ConstantPushInstruction.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ConstantPushInstruction.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ConstantPushInstruction.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ConstantPushInstruction.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;
 
-
 /**
  * Denotes a push instruction that produces a literal on the stack
  * such as  SIPUSH, BIPUSH, ICONST, etc.
@@ -28,6 +27,6 @@
  * @see SIPUSH
  */
 public interface ConstantPushInstruction extends PushInstruction, TypedInstruction {
-  public Number getValue();
-}
 
+    public Number getValue();
+}

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ConversionInstruction.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ConversionInstruction.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ConversionInstruction.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/ConversionInstruction.java Wed Mar 15 03:31:56 2006
@@ -13,53 +13,64 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License. 
  *
- */ 
+ */
 package org.apache.bcel.generic;
 
 import org.apache.bcel.Constants;
+
 /**
  * Super class for the x2y family of instructions.
  *
  * @version $Id$
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
-public abstract class ConversionInstruction extends Instruction
-  implements TypedInstruction, StackProducer, StackConsumer {
-  /**
-   * Empty constructor needed for the Class.newInstance() statement in
-   * Instruction.readInstruction(). Not to be used otherwise.
-   */
-  ConversionInstruction() {}
-
-  /**
-   * @param opcode opcode of instruction
-   */
-  protected ConversionInstruction(short opcode) {
-    super(opcode, (short)1);
-  }
-
-  /** @return type associated with the instruction
-   */
-  public Type getType(ConstantPoolGen cp) {
-    switch(opcode) {
-    case Constants.D2I: case Constants.F2I: case Constants.L2I:
-      return Type.INT;   
-    case Constants.D2F: case Constants.I2F: case Constants.L2F:
-      return Type.FLOAT;
-    case Constants.D2L: case Constants.F2L: case Constants.I2L:
-      return Type.LONG;
-    case Constants.F2D:  case Constants.I2D: case Constants.L2D:
-        return Type.DOUBLE;
-    case Constants.I2B:
-      return Type.BYTE;
-    case Constants.I2C:
-      return Type.CHAR;
-    case Constants.I2S:
-      return Type.SHORT;
- 
-    default: // Never reached
-      throw new ClassGenException("Unknown type " + opcode);
+public abstract class ConversionInstruction extends Instruction implements TypedInstruction,
+        StackProducer, StackConsumer {
+
+    /**
+     * Empty constructor needed for the Class.newInstance() statement in
+     * Instruction.readInstruction(). Not to be used otherwise.
+     */
+    ConversionInstruction() {
     }
-  }
-}
 
+
+    /**
+     * @param opcode opcode of instruction
+     */
+    protected ConversionInstruction(short opcode) {
+        super(opcode, (short) 1);
+    }
+
+
+    /** @return type associated with the instruction
+     */
+    public Type getType( ConstantPoolGen cp ) {
+        switch (opcode) {
+            case Constants.D2I:
+            case Constants.F2I:
+            case Constants.L2I:
+                return Type.INT;
+            case Constants.D2F:
+            case Constants.I2F:
+            case Constants.L2F:
+                return Type.FLOAT;
+            case Constants.D2L:
+            case Constants.F2L:
+            case Constants.I2L:
+                return Type.LONG;
+            case Constants.F2D:
+            case Constants.I2D:
+            case Constants.L2D:
+                return Type.DOUBLE;
+            case Constants.I2B:
+                return Type.BYTE;
+            case Constants.I2C:
+                return Type.CHAR;
+            case Constants.I2S:
+                return Type.SHORT;
+            default: // Never reached
+                throw new ClassGenException("Unknown type " + opcode);
+        }
+    }
+}

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/D2F.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/D2F.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/D2F.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/D2F.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;
 
-
 /** 
  * D2F - Convert double to float
  * <PRE>Stack: ..., value.word1, value.word2 -&gt; ..., result</PRE>
@@ -25,26 +24,27 @@
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
 public class D2F extends ConversionInstruction {
-  /** Convert double to float
-   */
-  public D2F() {
-    super(org.apache.bcel.Constants.D2F);
-  }
+
+    /** Convert double to float
+     */
+    public D2F() {
+        super(org.apache.bcel.Constants.D2F);
+    }
 
 
-  /**
-   * 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.visitConversionInstruction(this);
-    v.visitD2F(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.visitConversionInstruction(this);
+        v.visitD2F(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/D2I.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/D2I.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/D2I.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/D2I.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;
 
-
 /** 
  * D2I - Convert double to int
  * <PRE>Stack: ..., value.word1, value.word2 -&gt; ..., result</PRE>
@@ -25,26 +24,27 @@
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
 public class D2I extends ConversionInstruction {
-  /** Convert double to int
-   */
-  public D2I() {
-    super(org.apache.bcel.Constants.D2I);
-  }
+
+    /** Convert double to int
+     */
+    public D2I() {
+        super(org.apache.bcel.Constants.D2I);
+    }
 
 
-  /**
-   * 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.visitConversionInstruction(this);
-    v.visitD2I(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.visitConversionInstruction(this);
+        v.visitD2I(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/D2L.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/D2L.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/D2L.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/D2L.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;
 
-
 /** 
  * D2L - Convert double to long
  * <PRE>Stack: ..., value.word1, value.word2 -&gt; ..., result.word1, result.word2</PRE>
@@ -25,26 +24,27 @@
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
 public class D2L extends ConversionInstruction {
-  /** Convert double to long
-   */
-  public D2L() {
-    super(org.apache.bcel.Constants.D2L);
-  }
+
+    /** Convert double to long
+     */
+    public D2L() {
+        super(org.apache.bcel.Constants.D2L);
+    }
 
 
-  /**
-   * 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.visitConversionInstruction(this);
-    v.visitD2L(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.visitConversionInstruction(this);
+        v.visitD2L(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DADD.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DADD.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DADD.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DADD.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;
 
-
 /** 
  * DADD - Add doubles
  * <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -&gt;</PRE>
@@ -26,26 +25,27 @@
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
 public class DADD extends ArithmeticInstruction {
-  /** Add doubles
-   */
-  public DADD() {
-    super(org.apache.bcel.Constants.DADD);
-  }
+
+    /** Add doubles
+     */
+    public DADD() {
+        super(org.apache.bcel.Constants.DADD);
+    }
 
 
-  /**
-   * 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.visitDADD(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.visitDADD(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DALOAD.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DALOAD.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DALOAD.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DALOAD.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;
 
-
 /** 
  * DALOAD - Load double from array
  * <PRE>Stack: ..., arrayref, index -&gt; ..., result.word1, result.word2</PRE>
@@ -25,26 +24,27 @@
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
 public class DALOAD extends ArrayInstruction implements StackProducer {
-  /** Load double from array
-   */
-  public DALOAD() {
-    super(org.apache.bcel.Constants.DALOAD);
-  }
+
+    /** Load double from array
+     */
+    public DALOAD() {
+        super(org.apache.bcel.Constants.DALOAD);
+    }
 
 
-  /**
-   * 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.visitStackProducer(this);
-    v.visitExceptionThrower(this);
-    v.visitTypedInstruction(this);
-    v.visitArrayInstruction(this);
-    v.visitDALOAD(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.visitStackProducer(this);
+        v.visitExceptionThrower(this);
+        v.visitTypedInstruction(this);
+        v.visitArrayInstruction(this);
+        v.visitDALOAD(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DASTORE.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DASTORE.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DASTORE.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DASTORE.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;
 
-
 /** 
  * DASTORE -  Store into double array
  * <PRE>Stack: ..., arrayref, index, value.word1, value.word2 -&gt; ...</PRE>
@@ -25,26 +24,27 @@
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
 public class DASTORE extends ArrayInstruction implements StackConsumer {
-  /** Store double into array
-   */
-  public DASTORE() {
-    super(org.apache.bcel.Constants.DASTORE);
-  }
+
+    /** Store double into array
+     */
+    public DASTORE() {
+        super(org.apache.bcel.Constants.DASTORE);
+    }
 
 
-  /**
-   * 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.visitStackConsumer(this);
-    v.visitExceptionThrower(this);
-    v.visitTypedInstruction(this);
-    v.visitArrayInstruction(this);
-    v.visitDASTORE(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.visitStackConsumer(this);
+        v.visitExceptionThrower(this);
+        v.visitTypedInstruction(this);
+        v.visitArrayInstruction(this);
+        v.visitDASTORE(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DCMPG.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DCMPG.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DCMPG.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DCMPG.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;
 
-
 /** 
  * DCMPG - Compare doubles: value1 > value2
  * <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -&gt;</PRE>
@@ -25,32 +24,32 @@
  * @version $Id$
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
-public class DCMPG extends Instruction
-  implements TypedInstruction, StackProducer, StackConsumer {
+public class DCMPG extends Instruction implements TypedInstruction, StackProducer, StackConsumer {
 
-  public DCMPG() {
-    super(org.apache.bcel.Constants.DCMPG, (short)1);
-  }
-
-  /** @return Type.DOUBLE
-   */
-  public Type getType(ConstantPoolGen cp) {
-    return Type.DOUBLE;
-  }
-
-
-  /**
-   * 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.visitDCMPG(this);
-  }
+    public DCMPG() {
+        super(org.apache.bcel.Constants.DCMPG, (short) 1);
+    }
+
+
+    /** @return Type.DOUBLE
+     */
+    public Type getType( ConstantPoolGen cp ) {
+        return Type.DOUBLE;
+    }
+
+
+    /**
+     * 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.visitDCMPG(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DCMPL.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DCMPL.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DCMPL.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DCMPL.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;
 
-
 /** 
  * DCMPL - Compare doubles: value1 < value2
  * <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -&gt;</PRE>
@@ -25,31 +24,32 @@
  * @version $Id$
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
-public class DCMPL extends Instruction
-  implements TypedInstruction, StackProducer, StackConsumer {
-  public DCMPL() {
-    super(org.apache.bcel.Constants.DCMPL, (short)1);
-  }
-
-  /** @return Type.DOUBLE
-   */
-  public Type getType(ConstantPoolGen cp) {
-    return Type.DOUBLE;
-  }
-
-
-  /**
-   * 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.visitDCMPL(this);
-  }
+public class DCMPL extends Instruction implements TypedInstruction, StackProducer, StackConsumer {
+
+    public DCMPL() {
+        super(org.apache.bcel.Constants.DCMPL, (short) 1);
+    }
+
+
+    /** @return Type.DOUBLE
+     */
+    public Type getType( ConstantPoolGen cp ) {
+        return Type.DOUBLE;
+    }
+
+
+    /**
+     * 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.visitDCMPL(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DCONST.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DCONST.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DCONST.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DCONST.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;
 
-
 /** 
  * DCONST - Push 0.0 or 1.0, other values cause an exception
  *
@@ -25,50 +24,57 @@
  * @version $Id$
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
-public class DCONST extends Instruction
-  implements ConstantPushInstruction, TypedInstruction {
-  private double value;
-
-  /**
-   * Empty constructor needed for the Class.newInstance() statement in
-   * Instruction.readInstruction(). Not to be used otherwise.
-   */
-  DCONST() {}
-
-  public DCONST(double f) {
-    super(org.apache.bcel.Constants.DCONST_0, (short)1);
-
-    if(f == 0.0)
-      opcode = org.apache.bcel.Constants.DCONST_0;
-    else if(f == 1.0)
-      opcode = org.apache.bcel.Constants.DCONST_1;
-    else
-      throw new ClassGenException("DCONST can be used only for 0.0 and 1.0: " + f);
-
-    value = f;
-  }
-
-  public Number getValue() { return new Double(value); }
-
-  /** @return Type.DOUBLE
-   */
-  public Type getType(ConstantPoolGen cp) {
-    return Type.DOUBLE;
-  }
-
-  /**
-   * 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.visitPushInstruction(this);
-    v.visitStackProducer(this);
-    v.visitTypedInstruction(this);
-    v.visitConstantPushInstruction(this);
-    v.visitDCONST(this);
-  }
+public class DCONST extends Instruction implements ConstantPushInstruction, TypedInstruction {
+
+    private double value;
+
+
+    /**
+     * Empty constructor needed for the Class.newInstance() statement in
+     * Instruction.readInstruction(). Not to be used otherwise.
+     */
+    DCONST() {
+    }
+
+
+    public DCONST(double f) {
+        super(org.apache.bcel.Constants.DCONST_0, (short) 1);
+        if (f == 0.0) {
+            opcode = org.apache.bcel.Constants.DCONST_0;
+        } else if (f == 1.0) {
+            opcode = org.apache.bcel.Constants.DCONST_1;
+        } else {
+            throw new ClassGenException("DCONST can be used only for 0.0 and 1.0: " + f);
+        }
+        value = f;
+    }
+
+
+    public Number getValue() {
+        return new Double(value);
+    }
+
+
+    /** @return Type.DOUBLE
+     */
+    public Type getType( ConstantPoolGen cp ) {
+        return Type.DOUBLE;
+    }
+
+
+    /**
+     * 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.visitPushInstruction(this);
+        v.visitStackProducer(this);
+        v.visitTypedInstruction(this);
+        v.visitConstantPushInstruction(this);
+        v.visitDCONST(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DDIV.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DDIV.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DDIV.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DDIV.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;
 
-
 /** 
  * DDIV -  Divide doubles
  * <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -&gt;</PRE>
@@ -26,26 +25,27 @@
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
 public class DDIV extends ArithmeticInstruction {
-  /** Divide doubles
-   */
-  public DDIV() {
-    super(org.apache.bcel.Constants.DDIV);
-  }
+
+    /** Divide doubles
+     */
+    public DDIV() {
+        super(org.apache.bcel.Constants.DDIV);
+    }
 
 
-  /**
-   * 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.visitDDIV(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.visitDDIV(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DLOAD.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DLOAD.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DLOAD.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DLOAD.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;
 
-
 /** 
  * DLOAD - Load double from local variable
  * <PRE>Stack ... -&gt; ..., result.word1, result.word2</PRE>
@@ -25,31 +24,34 @@
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
 public class DLOAD extends LoadInstruction {
-  /**
-   * Empty constructor needed for the Class.newInstance() statement in
-   * Instruction.readInstruction(). Not to be used otherwise.
-   */
-  DLOAD() {
-    super(org.apache.bcel.Constants.DLOAD, org.apache.bcel.Constants.DLOAD_0);
-  }
-
-  /** Load double from local variable
-   * @param n index of local variable
-   */
-  public DLOAD(int n) {
-    super(org.apache.bcel.Constants.DLOAD, org.apache.bcel.Constants.DLOAD_0, n);
-  }
-
-  /**
-   * 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) {
-    super.accept(v);
-    v.visitDLOAD(this);
-  }
+
+    /**
+     * Empty constructor needed for the Class.newInstance() statement in
+     * Instruction.readInstruction(). Not to be used otherwise.
+     */
+    DLOAD() {
+        super(org.apache.bcel.Constants.DLOAD, org.apache.bcel.Constants.DLOAD_0);
+    }
+
+
+    /** Load double from local variable
+     * @param n index of local variable
+     */
+    public DLOAD(int n) {
+        super(org.apache.bcel.Constants.DLOAD, org.apache.bcel.Constants.DLOAD_0, n);
+    }
+
+
+    /**
+     * 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 ) {
+        super.accept(v);
+        v.visitDLOAD(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DMUL.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DMUL.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DMUL.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DMUL.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;
 
-
 /** 
  * DMUL - Multiply doubles
  * <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -&gt;</PRE>
@@ -26,26 +25,27 @@
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
 public class DMUL extends ArithmeticInstruction {
-  /** Multiply doubles
-   */
-  public DMUL() {
-    super(org.apache.bcel.Constants.DMUL);
-  }
+
+    /** Multiply doubles
+     */
+    public DMUL() {
+        super(org.apache.bcel.Constants.DMUL);
+    }
 
 
-  /**
-   * 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.visitDMUL(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.visitDMUL(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DNEG.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DNEG.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DNEG.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DNEG.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;
 
-
 /** 
  * DNEG - Negate double
  * <PRE>Stack: ..., value.word1, value.word2 -&gt; ..., result.word1, result.word2</PRE>
@@ -25,24 +24,25 @@
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
 public class DNEG extends ArithmeticInstruction {
-  public DNEG() {
-    super(org.apache.bcel.Constants.DNEG);
-  }
+
+    public DNEG() {
+        super(org.apache.bcel.Constants.DNEG);
+    }
 
 
-  /**
-   * 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.visitDNEG(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.visitDNEG(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DREM.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DREM.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DREM.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DREM.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;
 
-
 /** 
  * DREM - Remainder of doubles
  * <PRE>Stack: ..., value1.word1, value1.word2, value2.word1, value2.word2 -&gt;</PRE>
@@ -26,26 +25,27 @@
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
 public class DREM extends ArithmeticInstruction {
-  /** Remainder of doubles
-   */
-  public DREM() {
-    super(org.apache.bcel.Constants.DREM);
-  }
+
+    /** Remainder of doubles
+     */
+    public DREM() {
+        super(org.apache.bcel.Constants.DREM);
+    }
 
 
-  /**
-   * 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.visitDREM(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.visitDREM(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DRETURN.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DRETURN.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DRETURN.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DRETURN.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;
 
-
 /** 
  * DRETURN -  Return double from method
  * <PRE>Stack: ..., value.word1, value.word2 -&gt; &lt;empty&gt;</PRE>
@@ -25,26 +24,27 @@
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
 public class DRETURN extends ReturnInstruction {
-  /** Return double from method
-   */
-  public DRETURN() {
-    super(org.apache.bcel.Constants.DRETURN);
-  }
+
+    /** Return double from method
+     */
+    public DRETURN() {
+        super(org.apache.bcel.Constants.DRETURN);
+    }
 
 
-  /**
-   * 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.visitExceptionThrower(this);
-    v.visitTypedInstruction(this);
-    v.visitStackConsumer(this);
-    v.visitReturnInstruction(this);
-    v.visitDRETURN(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.visitExceptionThrower(this);
+        v.visitTypedInstruction(this);
+        v.visitStackConsumer(this);
+        v.visitReturnInstruction(this);
+        v.visitDRETURN(this);
+    }
 }

Modified: jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DSTORE.java
URL: http://svn.apache.org/viewcvs/jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DSTORE.java?rev=386056&r1=386055&r2=386056&view=diff
==============================================================================
--- jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DSTORE.java (original)
+++ jakarta/bcel/trunk/src/java/org/apache/bcel/generic/DSTORE.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;
 
-
 /** 
  * DSTORE - Store double into local variable
  * <pre>Stack: ..., value.word1, value.word2 -&gt; ... </PRE>
@@ -25,31 +24,34 @@
  * @author  <A HREF="mailto:[email protected]">M. Dahm</A>
  */
 public class DSTORE extends StoreInstruction {
-  /**
-   * Empty constructor needed for the Class.newInstance() statement in
-   * Instruction.readInstruction(). Not to be used otherwise.
-   */
-  DSTORE() {
-    super(org.apache.bcel.Constants.DSTORE, org.apache.bcel.Constants.DSTORE_0);
-  }
-
-  /** Store double into local variable
-   * @param n index of local variable
-   */
-  public DSTORE(int n) {
-    super(org.apache.bcel.Constants.DSTORE, org.apache.bcel.Constants.DSTORE_0, n);
-  }
-
-  /**
-   * 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) {
-    super.accept(v);
-    v.visitDSTORE(this);
-  }
+
+    /**
+     * Empty constructor needed for the Class.newInstance() statement in
+     * Instruction.readInstruction(). Not to be used otherwise.
+     */
+    DSTORE() {
+        super(org.apache.bcel.Constants.DSTORE, org.apache.bcel.Constants.DSTORE_0);
+    }
+
+
+    /** Store double into local variable
+     * @param n index of local variable
+     */
+    public DSTORE(int n) {
+        super(org.apache.bcel.Constants.DSTORE, org.apache.bcel.Constants.DSTORE_0, n);
+    }
+
+
+    /**
+     * 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 ) {
+        super.accept(v);
+        v.visitDSTORE(this);
+    }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.