tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1401253 [3/4] - in /tomcat/sandbox/trunk-resources: ./ java/javax/net/ java/javax/servlet/ java/javax/servlet/http/ java/org/apache/catalina/connector/ java/org/apache/catalina/core/ java/org/apache/catalina/filters/ java/org/apache/catali...
Date Tue, 23 Oct 2012 11:34:19 GMT
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java Tue Oct 23 11:34:15 2012
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * This class is derived from <em>Attribute</em> and denotes that this class
  * is an Inner class of another.
@@ -35,24 +33,10 @@ import org.apache.tomcat.util.bcel.Const
 public final class InnerClasses extends Attribute {
 
     private static final long serialVersionUID = 54179484605570305L;
-    private InnerClass[] inner_classes;
     private int number_of_classes;
 
 
     /**
-     * @param name_index Index in constant pool to CONSTANT_Utf8
-     * @param length Content length in bytes
-     * @param inner_classes array of inner classes attributes
-     * @param constant_pool Array of constants
-     */
-    public InnerClasses(int name_index, int length, InnerClass[] inner_classes,
-            ConstantPool constant_pool) {
-        super(Constants.ATTR_INNER_CLASSES, name_index, length, constant_pool);
-        setInnerClasses(inner_classes);
-    }
-
-
-    /**
      * Construct object from file stream.
      *
      * @param name_index Index in constant pool to CONSTANT_Utf8
@@ -63,48 +47,10 @@ public final class InnerClasses extends 
      */
     InnerClasses(int name_index, int length, DataInputStream file, ConstantPool constant_pool)
             throws IOException {
-        this(name_index, length, (InnerClass[]) null, constant_pool);
+        super(name_index, length, constant_pool);
         number_of_classes = file.readUnsignedShort();
-        inner_classes = new InnerClass[number_of_classes];
-        for (int i = 0; i < number_of_classes; i++) {
-            inner_classes[i] = new InnerClass(file);
-        }
-    }
-
-
-    /**
-     * @param inner_classes the array of inner classes
-     */
-    public final void setInnerClasses( InnerClass[] inner_classes ) {
-        this.inner_classes = inner_classes;
-        number_of_classes = (inner_classes == null) ? 0 : inner_classes.length;
-    }
-
-
-    /**
-     * @return String representation.
-     */
-    @Override
-    public final String toString() {
-        StringBuilder buf = new StringBuilder();
-        for (int i = 0; i < number_of_classes; i++) {
-            buf.append(inner_classes[i].toString(constant_pool)).append("\n");
-        }
-        return buf.toString();
-    }
-
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy( ConstantPool _constant_pool ) {
-        InnerClasses c = (InnerClasses) clone();
-        c.inner_classes = new InnerClass[number_of_classes];
         for (int i = 0; i < number_of_classes; i++) {
-            c.inner_classes[i] = inner_classes[i].copy();
+            Utility.swallowInnerClass(file);
         }
-        c.constant_pool = _constant_pool;
-        return c;
     }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/JavaClass.java Tue Oct 23 11:34:15 2012
@@ -19,7 +19,6 @@ package org.apache.tomcat.util.bcel.clas
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.StringTokenizer;
 
 import org.apache.tomcat.util.bcel.Constants;
 import org.apache.tomcat.util.bcel.util.BCELComparator;
@@ -39,16 +38,9 @@ public class JavaClass extends AccessFla
         implements Cloneable, Comparable<JavaClass> {
 
     private static final long serialVersionUID = 7029227708237523236L;
-    private String file_name;
-    private String source_file_name = "<Unknown>";
     private String class_name;
     private String superclass_name;
-    private int major, minor; // Compiler version
-    private ConstantPool constant_pool; // Constant pool
-    private int[] interfaces; // implemented interfaces
     private String[] interface_names;
-    private Field[] fields; // Fields, i.e., variables of class
-    private Method[] methods; // methods defined in the class
     private Attribute[] attributes; // attributes defined in the class
     private AnnotationEntry[] annotations;   // annotations defined on the class
 
@@ -81,48 +73,24 @@ public class JavaClass extends AccessFla
      * ConstantClass that represents this class.
      * @param superclass_name_index Index into constant pool referencing a
      * ConstantClass that represents this class's superclass.
-     * @param file_name File name
-     * @param major Major compiler version
-     * @param minor Minor compiler version
      * @param access_flags Access rights defined by bit flags
      * @param constant_pool Array of constants
      * @param interfaces Implemented interfaces
-     * @param fields Class fields
-     * @param methods Class methods
      * @param attributes Class attributes
      */
-    public JavaClass(int class_name_index, int superclass_name_index, String file_name, int major,
-            int minor, int access_flags, ConstantPool constant_pool, int[] interfaces,
-            Field[] fields, Method[] methods, Attribute[] attributes) {
+    public JavaClass(int class_name_index, int superclass_name_index,
+            int access_flags, ConstantPool constant_pool, int[] interfaces,
+            Attribute[] attributes) {
         if (interfaces == null) {
             interfaces = new int[0];
         }
         if (attributes == null) {
             attributes = new Attribute[0];
         }
-        if (fields == null) {
-            fields = new Field[0];
-        }
-        if (methods == null) {
-            methods = new Method[0];
-        }
-        this.file_name = file_name;
-        this.major = major;
-        this.minor = minor;
         this.access_flags = access_flags;
-        this.constant_pool = constant_pool;
-        this.interfaces = interfaces;
-        this.fields = fields;
-        this.methods = methods;
         this.attributes = attributes;
         annotationsOutOfDate = true;
-        // Get source file name if available
-        for (int i = 0; i < attributes.length; i++) {
-            if (attributes[i] instanceof SourceFile) {
-                source_file_name = ((SourceFile) attributes[i]).getSourceFileName();
-                break;
-            }
-        }
+
         /* According to the specification the following entries must be of type
          * `ConstantClass' but we check that anyway via the
          * `ConstPool.getConstant' method.
@@ -200,76 +168,6 @@ public class JavaClass extends AccessFla
 
 
     /**
-     * @return String representing class contents.
-     */
-    @Override
-    public String toString() {
-        String access = Utility.accessToString(access_flags, true);
-        access = access.equals("") ? "" : (access + " ");
-        StringBuilder buf = new StringBuilder(128);
-        buf.append(access).append(Utility.classOrInterface(access_flags)).append(" ").append(
-                class_name).append(" extends ").append(
-                Utility.compactClassName(superclass_name, false)).append('\n');
-        int size = interfaces.length;
-        if (size > 0) {
-            buf.append("implements\t\t");
-            for (int i = 0; i < size; i++) {
-                buf.append(interface_names[i]);
-                if (i < size - 1) {
-                    buf.append(", ");
-                }
-            }
-            buf.append('\n');
-        }
-        buf.append("filename\t\t").append(file_name).append('\n');
-        buf.append("compiled from\t\t").append(source_file_name).append('\n');
-        buf.append("compiler version\t").append(major).append(".").append(minor).append('\n');
-        buf.append("access flags\t\t").append(access_flags).append('\n');
-        buf.append("constant pool\t\t").append(constant_pool.getLength()).append(" entries\n");
-        buf.append("ACC_SUPER flag\t\t").append(isSuper()).append("\n");
-        if (attributes.length > 0) {
-            buf.append("\nAttribute(s):\n");
-            for (int i = 0; i < attributes.length; i++) {
-                buf.append(indent(attributes[i]));
-            }
-        }
-        AnnotationEntry[] annotations = getAnnotationEntries();
-        if (annotations!=null && annotations.length>0) {
-            buf.append("\nAnnotation(s):\n");
-            for (int i=0; i<annotations.length; i++)
-                buf.append(indent(annotations[i]));
-        }
-        if (fields.length > 0) {
-            buf.append("\n").append(fields.length).append(" fields:\n");
-            for (int i = 0; i < fields.length; i++) {
-                buf.append("\t").append(fields[i]).append('\n');
-            }
-        }
-        if (methods.length > 0) {
-            buf.append("\n").append(methods.length).append(" methods:\n");
-            for (int i = 0; i < methods.length; i++) {
-                buf.append("\t").append(methods[i]).append('\n');
-            }
-        }
-        return buf.toString();
-    }
-
-
-    private static final String indent( Object obj ) {
-        StringTokenizer tok = new StringTokenizer(obj.toString(), "\n");
-        StringBuilder buf = new StringBuilder();
-        while (tok.hasMoreTokens()) {
-            buf.append("\t").append(tok.nextToken()).append("\n");
-        }
-        return buf.toString();
-    }
-
-
-    public final boolean isSuper() {
-        return (access_flags & Constants.ACC_SUPER) != 0;
-    }
-
-    /**
      * Return value as defined by given BCELComparator strategy.
      * By default two JavaClass objects are said to be equal when
      * their class names are equal.

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/LineNumberTable.java Tue Oct 23 11:34:15 2012
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * This class represents a table of line numbers for debugging
  * purposes. This attribute is used by the <em>Code</em> attribute. It
@@ -30,26 +28,10 @@ import org.apache.tomcat.util.bcel.Const
  * @version $Id$
  * @author  <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
  * @see     Code
- * @see LineNumber
  */
 public final class LineNumberTable extends Attribute {
 
     private static final long serialVersionUID = 6585122636118666124L;
-    private int line_number_table_length;
-    private LineNumber[] line_number_table; // Table of line/numbers pairs
-
-
-    /*
-     * @param name_index Index of name
-     * @param length Content length in bytes
-     * @param line_number_table Table of line/numbers pairs
-     * @param constant_pool Array of constants
-     */
-    public LineNumberTable(int name_index, int length, LineNumber[] line_number_table,
-            ConstantPool constant_pool) {
-        super(Constants.ATTR_LINE_NUMBER_TABLE, name_index, length, constant_pool);
-        setLineNumberTable(line_number_table);
-    }
 
 
     /**
@@ -62,59 +44,10 @@ public final class LineNumberTable exten
      */
     LineNumberTable(int name_index, int length, DataInputStream file, ConstantPool constant_pool)
             throws IOException {
-        this(name_index, length, (LineNumber[]) null, constant_pool);
-        line_number_table_length = (file.readUnsignedShort());
-        line_number_table = new LineNumber[line_number_table_length];
-        for (int i = 0; i < line_number_table_length; i++) {
-            line_number_table[i] = new LineNumber(file);
-        }
-    }
-
-
-    /**
-     * @param line_number_table the line number entries for this table
-     */
-    public final void setLineNumberTable( LineNumber[] line_number_table ) {
-        this.line_number_table = line_number_table;
-        line_number_table_length = (line_number_table == null) ? 0 : line_number_table.length;
-    }
-
-
-    /**
-     * @return String representation.
-     */
-    @Override
-    public final String toString() {
-        StringBuilder buf = new StringBuilder();
-        StringBuilder line = new StringBuilder();
-        String newLine = System.getProperty("line.separator", "\n");
-        for (int i = 0; i < line_number_table_length; i++) {
-            line.append(line_number_table[i].toString());
-            if (i < line_number_table_length - 1) {
-                line.append(", ");
-            }
-            if (line.length() > 72) {
-                line.append(newLine);
-                buf.append(line.toString());
-                line.setLength(0);
-            }
-        }
-        buf.append(line);
-        return buf.toString();
-    }
-
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy( ConstantPool _constant_pool ) {
-        LineNumberTable c = (LineNumberTable) clone();
-        c.line_number_table = new LineNumber[line_number_table_length];
+        super(name_index, length, constant_pool);
+        int line_number_table_length = (file.readUnsignedShort());
         for (int i = 0; i < line_number_table_length; i++) {
-            c.line_number_table[i] = line_number_table[i].copy();
+            Utility.swallowLineNumber(file);
         }
-        c.constant_pool = _constant_pool;
-        return c;
     }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTable.java Tue Oct 23 11:34:15 2012
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * This class represents colection of local variables in a
  * method. This attribute is contained in the <em>Code</em> attribute.
@@ -29,26 +27,10 @@ import org.apache.tomcat.util.bcel.Const
  * @version $Id$
  * @author  <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
  * @see     Code
- * @see LocalVariable
  */
 public class LocalVariableTable extends Attribute {
 
     private static final long serialVersionUID = -3904314258294133920L;
-    private int local_variable_table_length; // Table of local
-    private LocalVariable[] local_variable_table; // variables
-
-
-    /**
-     * @param name_index Index in constant pool to `LocalVariableTable'
-     * @param length Content length in bytes
-     * @param local_variable_table Table of local variables
-     * @param constant_pool Array of constants
-     */
-    public LocalVariableTable(int name_index, int length, LocalVariable[] local_variable_table,
-            ConstantPool constant_pool) {
-        super(Constants.ATTR_LOCAL_VARIABLE_TABLE, name_index, length, constant_pool);
-        setLocalVariableTable(local_variable_table);
-    }
 
 
     /**
@@ -61,69 +43,10 @@ public class LocalVariableTable extends 
      */
     LocalVariableTable(int name_index, int length, DataInputStream file, ConstantPool constant_pool)
             throws IOException {
-        this(name_index, length, (LocalVariable[]) null, constant_pool);
-        local_variable_table_length = (file.readUnsignedShort());
-        local_variable_table = new LocalVariable[local_variable_table_length];
-        for (int i = 0; i < local_variable_table_length; i++) {
-            local_variable_table[i] = new LocalVariable(file, constant_pool);
-        }
-    }
-
-
-    /**
-     *
-     * @param index the variable slot
-     *
-     * @return the first LocalVariable that matches the slot or null if not found
-     *
-     * @deprecated since 5.2 because multiple variables can share the
-     *             same slot, use getLocalVariable(int index, int pc) instead.
-     */
-    @java.lang.Deprecated
-    public final LocalVariable getLocalVariable( int index ) {
-        for (int i = 0; i < local_variable_table_length; i++) {
-            if (local_variable_table[i].getIndex() == index) {
-                return local_variable_table[i];
-            }
-        }
-        return null;
-    }
-
-    public final void setLocalVariableTable( LocalVariable[] local_variable_table ) {
-        this.local_variable_table = local_variable_table;
-        local_variable_table_length = (local_variable_table == null)
-                ? 0
-                : local_variable_table.length;
-    }
-
-
-    /**
-     * @return String representation.
-     */
-    @Override
-    public final String toString() {
-        StringBuilder buf = new StringBuilder();
-        for (int i = 0; i < local_variable_table_length; i++) {
-            buf.append(local_variable_table[i].toString());
-            if (i < local_variable_table_length - 1) {
-                buf.append('\n');
-            }
-        }
-        return buf.toString();
-    }
-
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy( ConstantPool _constant_pool ) {
-        LocalVariableTable c = (LocalVariableTable) clone();
-        c.local_variable_table = new LocalVariable[local_variable_table_length];
+        super(name_index, length, constant_pool);
+        int local_variable_table_length = (file.readUnsignedShort());
         for (int i = 0; i < local_variable_table_length; i++) {
-            c.local_variable_table[i] = local_variable_table[i].copy();
+            Utility.swallowLocalVariable(file);
         }
-        c.constant_pool = _constant_pool;
-        return c;
     }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java Tue Oct 23 11:34:15 2012
@@ -19,8 +19,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 // The new table is used when generic types are about...
 
 //LocalVariableTable_attribute {
@@ -49,63 +47,16 @@ import org.apache.tomcat.util.bcel.Const
 //  }
 // J5TODO: Needs some testing !
 public class LocalVariableTypeTable extends Attribute {
-  private static final long serialVersionUID = -5466082154076451597L;
-private int             local_variable_type_table_length; // Table of local
-  private LocalVariable[] local_variable_type_table;        // variables
-
-  public LocalVariableTypeTable(int name_index, int length,
-                                LocalVariable[] local_variable_table,
-                                ConstantPool    constant_pool)
-  {
-    super(Constants.ATTR_LOCAL_VARIABLE_TYPE_TABLE, name_index, length, constant_pool);
-    setLocalVariableTable(local_variable_table);
-  }
-
-  LocalVariableTypeTable(int nameIdx, int len, DataInputStream dis,ConstantPool cpool) throws IOException {
-    this(nameIdx, len, (LocalVariable[])null, cpool);
-
-    local_variable_type_table_length = (dis.readUnsignedShort());
-    local_variable_type_table = new LocalVariable[local_variable_type_table_length];
-
-    for(int i=0; i < local_variable_type_table_length; i++)
-      local_variable_type_table[i] = new LocalVariable(dis, cpool);
-  }
-
-  public final void setLocalVariableTable(LocalVariable[] local_variable_table)
-  {
-    this.local_variable_type_table = local_variable_table;
-    local_variable_type_table_length = (local_variable_table == null)? 0 :
-      local_variable_table.length;
-  }
-
-  /**
-   * @return String representation.
-   */
-  @Override
-  public final String toString() {
-      StringBuilder buf = new StringBuilder();
-
-    for(int i=0; i < local_variable_type_table_length; i++) {
-      buf.append(local_variable_type_table[i].toString());
+    private static final long serialVersionUID = -5466082154076451597L;
 
-      if(i < local_variable_type_table_length - 1) buf.append('\n');
-    }
+    LocalVariableTypeTable(int name_index, int length,
+            DataInputStream dis, ConstantPool constant_pool)
+                    throws IOException {
+        super(name_index, length, constant_pool);
 
-    return buf.toString();
-  }
+        int local_variable_type_table_length = (dis.readUnsignedShort());
 
-  /**
-   * @return deep copy of this attribute
-   */
-  @Override
-  public Attribute copy(ConstantPool constant_pool) {
-    LocalVariableTypeTable c = (LocalVariableTypeTable)clone();
-
-    c.local_variable_type_table = new LocalVariable[local_variable_type_table_length];
-    for(int i=0; i < local_variable_type_table_length; i++)
-      c.local_variable_type_table[i] = local_variable_type_table[i].copy();
-
-    c.constant_pool = constant_pool;
-    return c;
-  }
+        for(int i=0; i < local_variable_type_table_length; i++)
+            Utility.swallowLocalVariable(dis);
+    }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/PMGClass.java Tue Oct 23 11:34:15 2012
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInput;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * This class is derived from <em>Attribute</em> and represents a reference
  * to a PMG attribute.
@@ -33,7 +31,6 @@ import org.apache.tomcat.util.bcel.Const
 public final class PMGClass extends Attribute {
 
     private static final long serialVersionUID = -1876065562391587509L;
-    private int pmg_class_index, pmg_index;
 
 
     /**
@@ -46,59 +43,8 @@ public final class PMGClass extends Attr
      */
     PMGClass(int name_index, int length, DataInput file, ConstantPool constant_pool)
             throws IOException {
-        this(name_index, length, file.readUnsignedShort(), file.readUnsignedShort(), constant_pool);
-    }
-
-
-    /**
-     * @param name_index Index in constant pool to CONSTANT_Utf8
-     * @param length Content length in bytes
-     * @param pmg_index index in constant pool for source file name
-     * @param pmg_class_index Index in constant pool to CONSTANT_Utf8
-     * @param constant_pool Array of constants
-     */
-    public PMGClass(int name_index, int length, int pmg_index, int pmg_class_index,
-            ConstantPool constant_pool) {
-        super(Constants.ATTR_PMG, name_index, length, constant_pool);
-        this.pmg_index = pmg_index;
-        this.pmg_class_index = pmg_class_index;
-    }
-
-
-    /**
-     * @return PMG name.
-     */
-    public final String getPMGName() {
-        ConstantUtf8 c = (ConstantUtf8) constant_pool.getConstant(pmg_index,
-                Constants.CONSTANT_Utf8);
-        return c.getBytes();
-    }
-
-
-    /**
-     * @return PMG class name.
-     */
-    public final String getPMGClassName() {
-        ConstantUtf8 c = (ConstantUtf8) constant_pool.getConstant(pmg_class_index,
-                Constants.CONSTANT_Utf8);
-        return c.getBytes();
-    }
-
-
-    /**
-     * @return String representation
-     */
-    @Override
-    public final String toString() {
-        return "PMGClass(" + getPMGName() + ", " + getPMGClassName() + ")";
-    }
-
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy( ConstantPool _constant_pool ) {
-        return (PMGClass) clone();
+        super(name_index, length, constant_pool);
+        file.readUnsignedShort();   // Unused pmg_index
+        file.readUnsignedShort();   // Unused pmg_class_index
     }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java Tue Oct 23 11:34:15 2012
@@ -35,15 +35,14 @@ public abstract class ParameterAnnotatio
 
 
     /**
-     * @param parameter_annotation_type the subclass type of the parameter annotation
      * @param name_index Index pointing to the name <em>Code</em>
      * @param length Content length in bytes
      * @param file Input stream
      * @param constant_pool Array of constants
      */
-    ParameterAnnotations(byte parameter_annotation_type, int name_index, int length,
+    ParameterAnnotations(int name_index, int length,
             DataInputStream file, ConstantPool constant_pool) throws IOException {
-        this(parameter_annotation_type, name_index, length, (ParameterAnnotationEntry[]) null,
+        this(name_index, length, (ParameterAnnotationEntry[]) null,
                 constant_pool);
         num_parameters = (file.readUnsignedByte());
         parameter_annotation_table = new ParameterAnnotationEntry[num_parameters];
@@ -54,15 +53,14 @@ public abstract class ParameterAnnotatio
 
 
     /**
-     * @param parameter_annotation_type the subclass type of the parameter annotation
      * @param name_index Index pointing to the name <em>Code</em>
      * @param length Content length in bytes
      * @param parameter_annotation_table the actual parameter annotations
      * @param constant_pool Array of constants
      */
-    public ParameterAnnotations(byte parameter_annotation_type, int name_index, int length,
+    public ParameterAnnotations(int name_index, int length,
             ParameterAnnotationEntry[] parameter_annotation_table, ConstantPool constant_pool) {
-        super(parameter_annotation_type, name_index, length, constant_pool);
+        super(name_index, length, constant_pool);
         setParameterAnnotationTable(parameter_annotation_table);
     }
 

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleAnnotations.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleAnnotations.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleAnnotations.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleAnnotations.java Tue Oct 23 11:34:15 2012
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * represents an annotation that is represented in the class file but is not
  * provided to the JVM.
@@ -48,17 +46,6 @@ public class RuntimeInvisibleAnnotations
                                 DataInputStream file, ConstantPool constant_pool)
                                 throws IOException
     {
-        super(Constants.ATTR_RUNTIMEIN_VISIBLE_ANNOTATIONS, name_index, length,
-                file, constant_pool);
-    }
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy(ConstantPool constant_pool)
-    {
-        Annotations c = (Annotations) clone();
-        return c;
+        super(name_index, length, file, constant_pool);
     }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleParameterAnnotations.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleParameterAnnotations.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleParameterAnnotations.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeInvisibleParameterAnnotations.java Tue Oct 23 11:34:15 2012
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * represents a parameter annotation that is represented in the class file
  * but is not provided to the JVM.
@@ -43,17 +41,6 @@ public class RuntimeInvisibleParameterAn
      */
     RuntimeInvisibleParameterAnnotations(int name_index, int length, DataInputStream file,
             ConstantPool constant_pool) throws IOException {
-        super(Constants.ATTR_RUNTIMEIN_VISIBLE_PARAMETER_ANNOTATIONS, name_index, length, file,
-                constant_pool);
-    }
-
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy( ConstantPool constant_pool ) {
-        Annotations c = (Annotations) clone();
-        return c;
+        super(name_index, length, file, constant_pool);
     }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java Tue Oct 23 11:34:15 2012
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * represents an annotation that is represented in the class file and is
  * provided to the JVM.
@@ -48,17 +46,6 @@ public class RuntimeVisibleAnnotations e
             DataInputStream file, ConstantPool constant_pool)
             throws IOException
     {
-        super(Constants.ATTR_RUNTIME_VISIBLE_ANNOTATIONS, name_index, length,
-                file, constant_pool);
-    }
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy(ConstantPool constant_pool)
-    {
-        Annotations c = (Annotations) clone();
-        return c;
+        super(name_index, length, file, constant_pool);
     }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java Tue Oct 23 11:34:15 2012
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * represents a parameter annotation that is represented in the class file
  * and is provided to the JVM.
@@ -43,17 +41,6 @@ public class RuntimeVisibleParameterAnno
      */
     RuntimeVisibleParameterAnnotations(int name_index, int length, DataInputStream file,
             ConstantPool constant_pool) throws IOException {
-        super(Constants.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS, name_index, length, file,
-                constant_pool);
-    }
-
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy( ConstantPool constant_pool ) {
-        Annotations c = (Annotations) clone();
-        return c;
+        super(name_index, length, file, constant_pool);
     }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Signature.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Signature.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Signature.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Signature.java Tue Oct 23 11:34:15 2012
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInput;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * This class is derived from <em>Attribute</em> and represents a reference
  * to a GJ attribute.
@@ -33,7 +31,6 @@ import org.apache.tomcat.util.bcel.Const
 public final class Signature extends Attribute {
 
     private static final long serialVersionUID = 7493781777025829964L;
-    private int signature_index;
 
 
     /**
@@ -46,46 +43,7 @@ public final class Signature extends Att
      */
     Signature(int name_index, int length, DataInput file, ConstantPool constant_pool)
             throws IOException {
-        this(name_index, length, file.readUnsignedShort(), constant_pool);
-    }
-
-
-    /**
-     * @param name_index Index in constant pool to CONSTANT_Utf8
-     * @param length Content length in bytes
-     * @param signature_index Index in constant pool to CONSTANT_Utf8
-     * @param constant_pool Array of constants
-     */
-    public Signature(int name_index, int length, int signature_index, ConstantPool constant_pool) {
-        super(Constants.ATTR_SIGNATURE, name_index, length, constant_pool);
-        this.signature_index = signature_index;
-    }
-
-
-    /**
-     * @return GJ signature.
-     */
-    public final String getSignature() {
-        ConstantUtf8 c = (ConstantUtf8) constant_pool.getConstant(signature_index,
-                Constants.CONSTANT_Utf8);
-        return c.getBytes();
-    }
-
-    /**
-     * @return String representation
-     */
-    @Override
-    public final String toString() {
-        String s = getSignature();
-        return "Signature(" + s + ")";
-    }
-
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy( ConstantPool _constant_pool ) {
-        return (Signature) clone();
+        super(name_index, length, constant_pool);
+        file.readUnsignedShort();   // Unused signature_index
     }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java Tue Oct 23 11:34:15 2012
@@ -17,9 +17,6 @@
  */
 package org.apache.tomcat.util.bcel.classfile;
 
-import java.io.DataOutputStream;
-import java.io.IOException;
-
 import org.apache.tomcat.util.bcel.Constants;
 
 public class SimpleElementValue extends ElementValue
@@ -41,12 +38,6 @@ public class SimpleElementValue extends 
     }
 
 
-    @Override
-    public String toString()
-    {
-        return stringifyValue();
-    }
-
     // Whatever kind of value it is, return it as a string
     @Override
     public String stringifyValue()
@@ -98,28 +89,4 @@ public class SimpleElementValue extends 
                             + type);
         }
     }
-
-    @Override
-    public void dump(DataOutputStream dos) throws IOException
-    {
-        dos.writeByte(type); // u1 kind of value
-        switch (type)
-        {
-        case PRIMITIVE_INT:
-        case PRIMITIVE_BYTE:
-        case PRIMITIVE_CHAR:
-        case PRIMITIVE_FLOAT:
-        case PRIMITIVE_LONG:
-        case PRIMITIVE_BOOLEAN:
-        case PRIMITIVE_SHORT:
-        case PRIMITIVE_DOUBLE:
-        case STRING:
-            dos.writeShort(getIndex());
-            break;
-        default:
-            throw new RuntimeException(
-                    "SimpleElementValue doesnt know how to write out type "
-                            + type);
-        }
-    }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/SourceFile.java Tue Oct 23 11:34:15 2012
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInput;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * This class is derived from <em>Attribute</em> and represents a reference
  * to the source file of this class.  At most one SourceFile attribute
@@ -35,7 +33,6 @@ import org.apache.tomcat.util.bcel.Const
 public final class SourceFile extends Attribute {
 
     private static final long serialVersionUID = 332346699609443704L;
-    private int sourcefile_index;
 
 
     /**
@@ -48,53 +45,7 @@ public final class SourceFile extends At
      */
     SourceFile(int name_index, int length, DataInput file, ConstantPool constant_pool)
             throws IOException {
-        this(name_index, length, file.readUnsignedShort(), constant_pool);
-    }
-
-
-    /**
-     * @param name_index Index in constant pool to CONSTANT_Utf8, which
-     * should represent the string "SourceFile".
-     * @param length Content length in bytes, the value should be 2.
-     * @param constant_pool The constant pool that this attribute is
-     * associated with.
-     * @param sourcefile_index Index in constant pool to CONSTANT_Utf8.  This
-     * string will be interpreted as the name of the file from which this
-     * class was compiled.  It will not be interpreted as indicating the name
-     * of the directory contqining the file or an absolute path; this
-     * information has to be supplied the consumer of this attribute - in
-     * many cases, the JVM.
-     */
-    public SourceFile(int name_index, int length, int sourcefile_index, ConstantPool constant_pool) {
-        super(Constants.ATTR_SOURCE_FILE, name_index, length, constant_pool);
-        this.sourcefile_index = sourcefile_index;
-    }
-
-
-    /**
-     * @return Source file name.
-     */
-    public final String getSourceFileName() {
-        ConstantUtf8 c = (ConstantUtf8) constant_pool.getConstant(sourcefile_index,
-                Constants.CONSTANT_Utf8);
-        return c.getBytes();
-    }
-
-
-    /**
-     * @return String representation
-     */
-    @Override
-    public final String toString() {
-        return "SourceFile(" + getSourceFileName() + ")";
-    }
-
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy( ConstantPool _constant_pool ) {
-        return (SourceFile) clone();
+        super(name_index, length, constant_pool);
+        file.readUnsignedShort();   // Unused sourcefile_index
     }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMap.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMap.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMap.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMap.java Tue Oct 23 11:34:15 2012
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * This class represents a stack map attribute used for
  * preverification of Java classes for the <a
@@ -51,7 +49,7 @@ public final class StackMap extends Attr
      * @param constant_pool Array of constants
      */
     public StackMap(int name_index, int length, StackMapEntry[] map, ConstantPool constant_pool) {
-        super(Constants.ATTR_STACK_MAP, name_index, length, constant_pool);
+        super(name_index, length, constant_pool);
         setStackMap(map);
     }
 
@@ -70,7 +68,7 @@ public final class StackMap extends Attr
         map_length = file.readUnsignedShort();
         map = new StackMapEntry[map_length];
         for (int i = 0; i < map_length; i++) {
-            map[i] = new StackMapEntry(file, constant_pool);
+            map[i] = new StackMapEntry(file);
         }
     }
 
@@ -82,36 +80,4 @@ public final class StackMap extends Attr
         this.map = map;
         map_length = (map == null) ? 0 : map.length;
     }
-
-
-    /**
-     * @return String representation.
-     */
-    @Override
-    public final String toString() {
-        StringBuilder buf = new StringBuilder("StackMap(");
-        for (int i = 0; i < map_length; i++) {
-            buf.append(map[i].toString());
-            if (i < map_length - 1) {
-                buf.append(", ");
-            }
-        }
-        buf.append(')');
-        return buf.toString();
-    }
-
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy( ConstantPool _constant_pool ) {
-        StackMap c = (StackMap) clone();
-        c.map = new StackMapEntry[map_length];
-        for (int i = 0; i < map_length; i++) {
-            c.map[i] = map[i].copy();
-        }
-        c.constant_pool = _constant_pool;
-        return c;
-    }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapEntry.java Tue Oct 23 11:34:15 2012
@@ -18,7 +18,6 @@
 package org.apache.tomcat.util.bcel.classfile;
 
 import java.io.DataInputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.Serializable;
 
@@ -36,7 +35,6 @@ public final class StackMapEntry impleme
 
     private static final long serialVersionUID = 1L;
 
-    private int byte_code_offset;
     private int number_of_locals;
     private StackMapType[] types_of_locals;
     private int number_of_stack_items;
@@ -48,92 +46,19 @@ public final class StackMapEntry impleme
      * @param file Input stream
      * @throws IOException
      */
-    StackMapEntry(DataInputStream file, ConstantPool constant_pool) throws IOException {
-        this(file.readShort(), file.readShort(), null, -1, null);
+    StackMapEntry(DataInputStream file) throws IOException {
+        file.readShort();   // Unused byte_code_offset
+        number_of_locals = file.readShort();
+        types_of_locals = null;
+        types_of_stack_items = null;
         types_of_locals = new StackMapType[number_of_locals];
         for (int i = 0; i < number_of_locals; i++) {
-            types_of_locals[i] = new StackMapType(file, constant_pool);
+            types_of_locals[i] = new StackMapType(file);
         }
         number_of_stack_items = file.readShort();
         types_of_stack_items = new StackMapType[number_of_stack_items];
         for (int i = 0; i < number_of_stack_items; i++) {
-            types_of_stack_items[i] = new StackMapType(file, constant_pool);
+            types_of_stack_items[i] = new StackMapType(file);
         }
     }
-
-
-    public StackMapEntry(int byte_code_offset, int number_of_locals,
-            StackMapType[] types_of_locals, int number_of_stack_items,
-            StackMapType[] types_of_stack_items) {
-        this.byte_code_offset = byte_code_offset;
-        this.number_of_locals = number_of_locals;
-        this.types_of_locals = types_of_locals;
-        this.number_of_stack_items = number_of_stack_items;
-        this.types_of_stack_items = types_of_stack_items;
-    }
-
-
-    /**
-     * Dump stack map entry
-     *
-     * @param file Output file stream
-     * @throws IOException
-     */
-    public final void dump( DataOutputStream file ) throws IOException {
-        file.writeShort(byte_code_offset);
-        file.writeShort(number_of_locals);
-        for (int i = 0; i < number_of_locals; i++) {
-            types_of_locals[i].dump(file);
-        }
-        file.writeShort(number_of_stack_items);
-        for (int i = 0; i < number_of_stack_items; i++) {
-            types_of_stack_items[i].dump(file);
-        }
-    }
-
-
-    /**
-     * @return String representation.
-     */
-    @Override
-    public final String toString() {
-        StringBuilder buf = new StringBuilder(64);
-        buf.append("(offset=").append(byte_code_offset);
-        if (number_of_locals > 0) {
-            buf.append(", locals={");
-            for (int i = 0; i < number_of_locals; i++) {
-                buf.append(types_of_locals[i]);
-                if (i < number_of_locals - 1) {
-                    buf.append(", ");
-                }
-            }
-            buf.append("}");
-        }
-        if (number_of_stack_items > 0) {
-            buf.append(", stack items={");
-            for (int i = 0; i < number_of_stack_items; i++) {
-                buf.append(types_of_stack_items[i]);
-                if (i < number_of_stack_items - 1) {
-                    buf.append(", ");
-                }
-            }
-            buf.append("}");
-        }
-        buf.append(")");
-        return buf.toString();
-    }
-
-
-    /**
-     * @return deep copy of this object
-     */
-    public StackMapEntry copy() {
-        try {
-            return (StackMapEntry) clone();
-        } catch (CloneNotSupportedException e) {
-        }
-        return null;
-    }
-
-
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapTable.java Tue Oct 23 11:34:15 2012
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * This class represents a stack map attribute used for
  * preverification of Java classes for the <a
@@ -51,7 +49,7 @@ public final class StackMapTable extends
      * @param constant_pool Array of constants
      */
     public StackMapTable(int name_index, int length, StackMapTableEntry[] map, ConstantPool constant_pool) {
-        super(Constants.ATTR_STACK_MAP_TABLE, name_index, length, constant_pool);
+        super(name_index, length, constant_pool);
         setStackMapTable(map);
     }
 
@@ -70,7 +68,7 @@ public final class StackMapTable extends
         map_length = file.readUnsignedShort();
         map = new StackMapTableEntry[map_length];
         for (int i = 0; i < map_length; i++) {
-            map[i] = new StackMapTableEntry(file, constant_pool);
+            map[i] = new StackMapTableEntry(file);
         }
     }
 
@@ -82,36 +80,4 @@ public final class StackMapTable extends
         this.map = map;
         map_length = (map == null) ? 0 : map.length;
     }
-
-
-    /**
-     * @return String representation.
-     */
-    @Override
-    public final String toString() {
-        StringBuilder buf = new StringBuilder("StackMapTable(");
-        for (int i = 0; i < map_length; i++) {
-            buf.append(map[i].toString());
-            if (i < map_length - 1) {
-                buf.append(", ");
-            }
-        }
-        buf.append(')');
-        return buf.toString();
-    }
-
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy( ConstantPool _constant_pool ) {
-        StackMapTable c = (StackMapTable) clone();
-        c.map = new StackMapTableEntry[map_length];
-        for (int i = 0; i < map_length; i++) {
-            c.map[i] = map[i].copy();
-        }
-        c.constant_pool = _constant_pool;
-        return c;
-    }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapTableEntry.java Tue Oct 23 11:34:15 2012
@@ -18,7 +18,6 @@
 package org.apache.tomcat.util.bcel.classfile;
 
 import java.io.DataInputStream;
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.Serializable;
 
@@ -39,7 +38,6 @@ public final class StackMapTableEntry im
     private static final long serialVersionUID = 1L;
 
     private int frame_type;
-    private int byte_code_offset_delta;
     private int number_of_locals;
     private StackMapType[] types_of_locals;
     private int number_of_stack_items;
@@ -51,43 +49,42 @@ public final class StackMapTableEntry im
      * @param file Input stream
      * @throws IOException
      */
-    StackMapTableEntry(DataInputStream file, ConstantPool constant_pool) throws IOException {
-        this(file.read(), -1, -1, null, -1, null);
+    StackMapTableEntry(DataInputStream file) throws IOException {
+        this(file.read(), -1, null, -1, null);
 
         if (frame_type >= Constants.SAME_FRAME && frame_type <= Constants.SAME_FRAME_MAX) {
-            byte_code_offset_delta = frame_type - Constants.SAME_FRAME;
+            // NO-OP
         } else if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME && frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
-            byte_code_offset_delta = frame_type - Constants.SAME_LOCALS_1_STACK_ITEM_FRAME;
             number_of_stack_items = 1;
             types_of_stack_items = new StackMapType[1];
-            types_of_stack_items[0] = new StackMapType(file, constant_pool);
+            types_of_stack_items[0] = new StackMapType(file);
         } else if (frame_type == Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
-            byte_code_offset_delta = file.readShort();
+            file.readShort(); // Unused byte_code_offset_delta
             number_of_stack_items = 1;
             types_of_stack_items = new StackMapType[1];
-            types_of_stack_items[0] = new StackMapType(file, constant_pool);
+            types_of_stack_items[0] = new StackMapType(file);
         } else if (frame_type >= Constants.CHOP_FRAME && frame_type <= Constants.CHOP_FRAME_MAX) {
-            byte_code_offset_delta = file.readShort();
+            file.readShort(); // Unused byte_code_offset_delta
         } else if (frame_type == Constants.SAME_FRAME_EXTENDED) {
-            byte_code_offset_delta = file.readShort();
+            file.readShort(); // Unused byte_code_offset_delta
         } else if (frame_type >= Constants.APPEND_FRAME && frame_type <= Constants.APPEND_FRAME_MAX) {
-            byte_code_offset_delta = file.readShort();
+            file.readShort(); // Unused byte_code_offset_delta
             number_of_locals = frame_type - 251;
             types_of_locals = new StackMapType[number_of_locals];
             for (int i = 0; i < number_of_locals; i++) {
-                types_of_locals[i] = new StackMapType(file, constant_pool);
+                types_of_locals[i] = new StackMapType(file);
             }
         } else if (frame_type == Constants.FULL_FRAME) {
-            byte_code_offset_delta = file.readShort();
+            file.readShort(); // Unused byte_code_offset_delta
             number_of_locals = file.readShort();
             types_of_locals = new StackMapType[number_of_locals];
             for (int i = 0; i < number_of_locals; i++) {
-                types_of_locals[i] = new StackMapType(file, constant_pool);
+                types_of_locals[i] = new StackMapType(file);
             }
             number_of_stack_items = file.readShort();
             types_of_stack_items = new StackMapType[number_of_stack_items];
             for (int i = 0; i < number_of_stack_items; i++) {
-                types_of_stack_items[i] = new StackMapType(file, constant_pool);
+                types_of_stack_items[i] = new StackMapType(file);
             }
         } else {
             /* Can't happen */
@@ -96,117 +93,13 @@ public final class StackMapTableEntry im
     }
 
 
-    public StackMapTableEntry(int tag, int byte_code_offset_delta, int number_of_locals,
+    public StackMapTableEntry(int tag, int number_of_locals,
             StackMapType[] types_of_locals, int number_of_stack_items,
             StackMapType[] types_of_stack_items) {
         this.frame_type = tag;
-        this.byte_code_offset_delta = byte_code_offset_delta;
         this.number_of_locals = number_of_locals;
         this.types_of_locals = types_of_locals;
         this.number_of_stack_items = number_of_stack_items;
         this.types_of_stack_items = types_of_stack_items;
     }
-
-
-    /**
-     * Dump stack map entry
-     *
-     * @param file Output file stream
-     * @throws IOException
-     */
-    public final void dump( DataOutputStream file ) throws IOException {
-        file.write(frame_type);
-        if (frame_type >= Constants.SAME_FRAME && frame_type <= Constants.SAME_FRAME_MAX) {
-            // nothing to be done
-        } else if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME && frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
-            types_of_stack_items[0].dump(file);
-        } else if (frame_type == Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
-            file.writeShort(byte_code_offset_delta);
-            types_of_stack_items[0].dump(file);
-        } else if (frame_type >= Constants.CHOP_FRAME && frame_type <= Constants.CHOP_FRAME_MAX) {
-            file.writeShort(byte_code_offset_delta);
-        } else if (frame_type == Constants.SAME_FRAME_EXTENDED) {
-            file.writeShort(byte_code_offset_delta);
-        } else if (frame_type >= Constants.APPEND_FRAME && frame_type <= Constants.APPEND_FRAME_MAX) {
-            file.writeShort(byte_code_offset_delta);
-            for (int i = 0; i < number_of_locals; i++) {
-                types_of_locals[i].dump(file);
-            }
-        } else if (frame_type == Constants.FULL_FRAME) {
-            file.writeShort(byte_code_offset_delta);
-            file.writeShort(number_of_locals);
-            for (int i = 0; i < number_of_locals; i++) {
-                types_of_locals[i].dump(file);
-            }
-            file.writeShort(number_of_stack_items);
-            for (int i = 0; i < number_of_stack_items; i++) {
-                types_of_stack_items[i].dump(file);
-            }
-        } else {
-            /* Can't happen */
-            throw new ClassFormatException ("Invalid Stack map table tag: " + frame_type);
-        }
-    }
-
-
-    /**
-     * @return String representation.
-     */
-    @Override
-    public final String toString() {
-        StringBuilder buf = new StringBuilder(64);
-        buf.append("(");
-        if (frame_type >= Constants.SAME_FRAME && frame_type <= Constants.SAME_FRAME_MAX) {
-            buf.append("SAME");
-        } else if (frame_type >= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME && frame_type <= Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_MAX) {
-            buf.append("SAME_LOCALS_1_STACK");
-        } else if (frame_type == Constants.SAME_LOCALS_1_STACK_ITEM_FRAME_EXTENDED) {
-            buf.append("SAME_LOCALS_1_STACK_EXTENDED");
-        } else if (frame_type >= Constants.CHOP_FRAME && frame_type <= Constants.CHOP_FRAME_MAX) {
-            buf.append("CHOP "+(251-frame_type));
-        } else if (frame_type == Constants.SAME_FRAME_EXTENDED) {
-            buf.append("SAME_EXTENDED");
-        } else if (frame_type >= Constants.APPEND_FRAME && frame_type <= Constants.APPEND_FRAME_MAX) {
-            buf.append("APPEND "+(frame_type-251));
-        } else if (frame_type == Constants.FULL_FRAME) {
-            buf.append("FULL");
-        } else {
-            buf.append("UNKNOWN");
-        }
-        buf.append(", offset delta=").append(byte_code_offset_delta);
-        if (number_of_locals > 0) {
-            buf.append(", locals={");
-            for (int i = 0; i < number_of_locals; i++) {
-                buf.append(types_of_locals[i]);
-                if (i < number_of_locals - 1) {
-                    buf.append(", ");
-                }
-            }
-            buf.append("}");
-        }
-        if (number_of_stack_items > 0) {
-            buf.append(", stack items={");
-            for (int i = 0; i < number_of_stack_items; i++) {
-                buf.append(types_of_stack_items[i]);
-                if (i < number_of_stack_items - 1) {
-                    buf.append(", ");
-                }
-            }
-            buf.append("}");
-        }
-        buf.append(")");
-        return buf.toString();
-    }
-
-
-    /**
-     * @return deep copy of this object
-     */
-    public StackMapTableEntry copy() {
-        try {
-            return (StackMapTableEntry) clone();
-        } catch (CloneNotSupportedException e) {
-        }
-        return null;
-    }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapType.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapType.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapType.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/StackMapType.java Tue Oct 23 11:34:15 2012
@@ -18,7 +18,6 @@
 package org.apache.tomcat.util.bcel.classfile;
 
 import java.io.DataInput;
-import java.io.DataOutputStream;
 import java.io.IOException;
 import java.io.Serializable;
 
@@ -39,8 +38,6 @@ public final class StackMapType implemen
     private static final long serialVersionUID = 1L;
 
     private byte type;
-    private int index = -1; // Index to CONSTANT_Class or offset
-    private ConstantPool constant_pool;
 
 
     /**
@@ -48,23 +45,11 @@ public final class StackMapType implemen
      * @param file Input stream
      * @throws IOException
      */
-    StackMapType(DataInput file, ConstantPool constant_pool) throws IOException {
-        this(file.readByte(), -1, constant_pool);
+    StackMapType(DataInput file) throws IOException {
+        setType(file.readByte());
         if (hasIndex()) {
-            setIndex(file.readShort());
+            file.readShort();   // Unused index
         }
-        setConstantPool(constant_pool);
-    }
-
-
-    /**
-     * @param type type tag as defined in the Constants interface
-     * @param index index to constant pool, or byte code offset
-     */
-    public StackMapType(byte type, int index, ConstantPool constant_pool) {
-        setType(type);
-        setIndex(index);
-        setConstantPool(constant_pool);
     }
 
 
@@ -76,67 +61,9 @@ public final class StackMapType implemen
     }
 
 
-    public void setIndex( int t ) {
-        index = t;
-    }
-
-
-    /** @return index to constant pool if type == ITEM_Object, or offset
-     * in byte code, if type == ITEM_NewObject, and -1 otherwise
-     */
-    public int getIndex() {
-        return index;
-    }
-
-
-    /**
-     * Dump type entries to file.
-     *
-     * @param file Output file stream
-     * @throws IOException
-     */
-    public final void dump( DataOutputStream file ) throws IOException {
-        file.writeByte(type);
-        if (hasIndex()) {
-            file.writeShort(getIndex());
-        }
-    }
-
-
     /** @return true, if type is either ITEM_Object or ITEM_NewObject
      */
     public final boolean hasIndex() {
         return ((type == Constants.ITEM_Object) || (type == Constants.ITEM_NewObject));
     }
-
-
-    private String printIndex() {
-        if (type == Constants.ITEM_Object) {
-            if (index < 0) {
-                return ", class=<unknown>";
-            }
-            return ", class=" + constant_pool.constantToString(index, Constants.CONSTANT_Class);
-        } else if (type == Constants.ITEM_NewObject) {
-            return ", offset=" + index;
-        } else {
-            return "";
-        }
-    }
-
-
-    /**
-     * @return String representation
-     */
-    @Override
-    public final String toString() {
-        return "(type=" + Constants.ITEM_NAMES[type] + printIndex() + ")";
-    }
-
-
-    /**
-     * @param constant_pool Constant pool to be used for this object.
-     */
-    public final void setConstantPool( ConstantPool constant_pool ) {
-        this.constant_pool = constant_pool;
-    }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Synthetic.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Synthetic.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Synthetic.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Synthetic.java Tue Oct 23 11:34:15 2012
@@ -20,8 +20,6 @@ package org.apache.tomcat.util.bcel.clas
 import java.io.DataInputStream;
 import java.io.IOException;
 
-import org.apache.tomcat.util.bcel.Constants;
-
 /**
  * This class is derived from <em>Attribute</em> and declares this class as
  * `synthetic', i.e., it needs special handling.  The JVM specification
@@ -50,7 +48,7 @@ public final class Synthetic extends Att
      * with.
      */
     public Synthetic(int name_index, int length, byte[] bytes, ConstantPool constant_pool) {
-        super(Constants.ATTR_SYNTHETIC, name_index, length, constant_pool);
+        super(name_index, length, constant_pool);
         this.bytes = bytes;
     }
 
@@ -72,32 +70,4 @@ public final class Synthetic extends Att
             System.err.println("Synthetic attribute with length > 0");
         }
     }
-
-
-    /**
-     * @return String representation.
-     */
-    @Override
-    public final String toString() {
-        StringBuilder buf = new StringBuilder("Synthetic");
-        if (length > 0) {
-            buf.append(" ").append(Utility.toHexString(bytes));
-        }
-        return buf.toString();
-    }
-
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy( ConstantPool _constant_pool ) {
-        Synthetic c = (Synthetic) clone();
-        if (bytes != null) {
-            c.bytes = new byte[bytes.length];
-            System.arraycopy(bytes, 0, c.bytes, 0, bytes.length);
-        }
-        c.constant_pool = _constant_pool;
-        return c;
-    }
 }

Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Unknown.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Unknown.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Unknown.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Unknown.java Tue Oct 23 11:34:15 2012
@@ -37,7 +37,6 @@ import org.apache.tomcat.util.bcel.Const
  *
  * @version $Id$
  * @see org.apache.tomcat.util.bcel.classfile.Attribute
- * @see org.apache.tomcat.util.bcel.classfile.AttributeReader
  * @author  <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
  */
 public final class Unknown extends Attribute {
@@ -58,7 +57,7 @@ public final class Unknown extends Attri
      * @param constant_pool Array of constants
      */
     public Unknown(int name_index, int length, byte[] bytes, ConstantPool constant_pool) {
-        super(Constants.ATTR_UNKNOWN, name_index, length, constant_pool);
+        super(name_index, length, constant_pool);
         this.bytes = bytes;
         name = ((ConstantUtf8) constant_pool.getConstant(name_index, Constants.CONSTANT_Utf8))
                 .getBytes();
@@ -91,39 +90,4 @@ public final class Unknown extends Attri
     public final String getName() {
         return name;
     }
-
-
-    /**
-     * @return String representation.
-     */
-    @Override
-    public final String toString() {
-        if (length == 0 || bytes == null) {
-            return "(Unknown attribute " + name + ")";
-        }
-        String hex;
-        if (length > 10) {
-            byte[] tmp = new byte[10];
-            System.arraycopy(bytes, 0, tmp, 0, 10);
-            hex = Utility.toHexString(tmp) + "... (truncated)";
-        } else {
-            hex = Utility.toHexString(bytes);
-        }
-        return "(Unknown attribute " + name + ": " + hex + ")";
-    }
-
-
-    /**
-     * @return deep copy of this attribute
-     */
-    @Override
-    public Attribute copy( ConstantPool _constant_pool ) {
-        Unknown c = (Unknown) clone();
-        if (bytes != null) {
-            c.bytes = new byte[bytes.length];
-            System.arraycopy(bytes, 0, c.bytes, 0, bytes.length);
-        }
-        c.constant_pool = _constant_pool;
-        return c;
-    }
 }



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


Mime
View raw message