You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2012/10/23 13:34:19 UTC
svn commit: r1401253 [2/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...
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/Constants.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/Constants.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/Constants.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/Constants.java Tue Oct 23 11:34:15 2012
@@ -41,26 +41,6 @@ public interface Constants {
*/
public static final short ACC_ANNOTATION = 0x2000;
- /** One of the access flags for fields, methods, or classes.
- */
- public static final short ACC_ENUM = 0x4000;
-
- // Applies to classes compiled by new compilers only
- /** One of the access flags for fields, methods, or classes.
- */
- public static final short ACC_SUPER = 0x0020;
-
- /** One of the access flags for fields, methods, or classes.
- */
- public static final short MAX_ACC_FLAG = ACC_ENUM;
-
- /** The names of the access flags. */
- public static final String[] ACCESS_NAMES = {
- "public", "private", "protected", "static", "final", "synchronized",
- "volatile", "transient", "native", "interface", "abstract", "strictfp",
- "synthetic", "annotation", "enum"
- };
-
/** Marks a constant pool entry as type UTF-8. */
public static final byte CONSTANT_Utf8 = 1;
@@ -112,386 +92,6 @@ public interface Constants {
"CONSTANT_NameAndType", "CONSTANT_MethodHandle",
"CONSTANT_MethodType", "CONSTANT_InvokeDynamic" };
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short LDC = 18;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short LDC_W = 19;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short LDC2_W = 20;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short ILOAD = 21;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short LLOAD = 22;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short FLOAD = 23;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short DLOAD = 24;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short ALOAD = 25;
-
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short ISTORE = 54;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short LSTORE = 55;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short FSTORE = 56;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short DSTORE = 57;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short ASTORE = 58;
-
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IINC = 132;
-
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IFEQ = 153;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IFNE = 154;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IFLT = 155;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IFGE = 156;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IFGT = 157;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IFLE = 158;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IF_ICMPEQ = 159;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IF_ICMPNE = 160;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IF_ICMPLT = 161;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IF_ICMPGE = 162;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IF_ICMPGT = 163;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IF_ICMPLE = 164;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IF_ACMPEQ = 165;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IF_ACMPNE = 166;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short GOTO = 167;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short JSR = 168;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short RET = 169;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short TABLESWITCH = 170;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short LOOKUPSWITCH = 171;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short GETSTATIC = 178;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short PUTSTATIC = 179;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short GETFIELD = 180;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short PUTFIELD = 181;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short INVOKEVIRTUAL = 182;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short INVOKESPECIAL = 183;
-
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short INVOKESTATIC = 184;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short INVOKEINTERFACE = 185;
-
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short NEW = 187;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short NEWARRAY = 188;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short ANEWARRAY = 189;
-
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short CHECKCAST = 192;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short INSTANCEOF = 193;
-
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short WIDE = 196;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short MULTIANEWARRAY = 197;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IFNULL = 198;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short IFNONNULL = 199;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short GOTO_W = 200;
- /** Java VM opcode.
- * @see <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html">Opcode definitions in The Java Virtual Machine Specification</a> */
- public static final short JSR_W = 201;
-
- /** Illegal opcode. */
- public static final short UNDEFINED = -1;
- /** Illegal opcode. */
- public static final short UNPREDICTABLE = -2;
- /** Illegal opcode. */
- public static final short RESERVED = -3;
- /** Mnemonic for an illegal opcode. */
- public static final String ILLEGAL_OPCODE = "<illegal opcode>";
- /** Mnemonic for an illegal type. */
- public static final String ILLEGAL_TYPE = "<illegal type>";
-
- /** Byte data type. */
- public static final byte T_BYTE = 8;
- /** Short data type. */
- public static final byte T_SHORT = 9;
- /** Int data type. */
- public static final byte T_INT = 10;
-
-
- /** The primitive type names corresponding to the T_XX constants,
- * e.g., TYPE_NAMES[T_INT] = "int"
- */
- public static final String[] TYPE_NAMES = {
- ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE, ILLEGAL_TYPE,
- "boolean", "char", "float", "double", "byte", "short", "int", "long",
- "void", "array", "object", "unknown", "address"
- };
-
-
- /**
- * Number of byte code operands for each opcode, i.e., number of bytes after the tag byte
- * itself. Indexed by opcode, so NO_OF_OPERANDS[BIPUSH] = the number of operands for a bipush
- * instruction.
- */
- public static final short[] NO_OF_OPERANDS = {
- 0/*nop*/, 0/*aconst_null*/, 0/*iconst_m1*/, 0/*iconst_0*/,
- 0/*iconst_1*/, 0/*iconst_2*/, 0/*iconst_3*/, 0/*iconst_4*/,
- 0/*iconst_5*/, 0/*lconst_0*/, 0/*lconst_1*/, 0/*fconst_0*/,
- 0/*fconst_1*/, 0/*fconst_2*/, 0/*dconst_0*/, 0/*dconst_1*/,
- 1/*bipush*/, 2/*sipush*/, 1/*ldc*/, 2/*ldc_w*/, 2/*ldc2_w*/,
- 1/*iload*/, 1/*lload*/, 1/*fload*/, 1/*dload*/, 1/*aload*/,
- 0/*iload_0*/, 0/*iload_1*/, 0/*iload_2*/, 0/*iload_3*/,
- 0/*lload_0*/, 0/*lload_1*/, 0/*lload_2*/, 0/*lload_3*/,
- 0/*fload_0*/, 0/*fload_1*/, 0/*fload_2*/, 0/*fload_3*/,
- 0/*dload_0*/, 0/*dload_1*/, 0/*dload_2*/, 0/*dload_3*/,
- 0/*aload_0*/, 0/*aload_1*/, 0/*aload_2*/, 0/*aload_3*/,
- 0/*iaload*/, 0/*laload*/, 0/*faload*/, 0/*daload*/,
- 0/*aaload*/, 0/*baload*/, 0/*caload*/, 0/*saload*/,
- 1/*istore*/, 1/*lstore*/, 1/*fstore*/, 1/*dstore*/,
- 1/*astore*/, 0/*istore_0*/, 0/*istore_1*/, 0/*istore_2*/,
- 0/*istore_3*/, 0/*lstore_0*/, 0/*lstore_1*/, 0/*lstore_2*/,
- 0/*lstore_3*/, 0/*fstore_0*/, 0/*fstore_1*/, 0/*fstore_2*/,
- 0/*fstore_3*/, 0/*dstore_0*/, 0/*dstore_1*/, 0/*dstore_2*/,
- 0/*dstore_3*/, 0/*astore_0*/, 0/*astore_1*/, 0/*astore_2*/,
- 0/*astore_3*/, 0/*iastore*/, 0/*lastore*/, 0/*fastore*/,
- 0/*dastore*/, 0/*aastore*/, 0/*bastore*/, 0/*castore*/,
- 0/*sastore*/, 0/*pop*/, 0/*pop2*/, 0/*dup*/, 0/*dup_x1*/,
- 0/*dup_x2*/, 0/*dup2*/, 0/*dup2_x1*/, 0/*dup2_x2*/, 0/*swap*/,
- 0/*iadd*/, 0/*ladd*/, 0/*fadd*/, 0/*dadd*/, 0/*isub*/,
- 0/*lsub*/, 0/*fsub*/, 0/*dsub*/, 0/*imul*/, 0/*lmul*/,
- 0/*fmul*/, 0/*dmul*/, 0/*idiv*/, 0/*ldiv*/, 0/*fdiv*/,
- 0/*ddiv*/, 0/*irem*/, 0/*lrem*/, 0/*frem*/, 0/*drem*/,
- 0/*ineg*/, 0/*lneg*/, 0/*fneg*/, 0/*dneg*/, 0/*ishl*/,
- 0/*lshl*/, 0/*ishr*/, 0/*lshr*/, 0/*iushr*/, 0/*lushr*/,
- 0/*iand*/, 0/*land*/, 0/*ior*/, 0/*lor*/, 0/*ixor*/, 0/*lxor*/,
- 2/*iinc*/, 0/*i2l*/, 0/*i2f*/, 0/*i2d*/, 0/*l2i*/, 0/*l2f*/,
- 0/*l2d*/, 0/*f2i*/, 0/*f2l*/, 0/*f2d*/, 0/*d2i*/, 0/*d2l*/,
- 0/*d2f*/, 0/*i2b*/, 0/*i2c*/, 0/*i2s*/, 0/*lcmp*/, 0/*fcmpl*/,
- 0/*fcmpg*/, 0/*dcmpl*/, 0/*dcmpg*/, 2/*ifeq*/, 2/*ifne*/,
- 2/*iflt*/, 2/*ifge*/, 2/*ifgt*/, 2/*ifle*/, 2/*if_icmpeq*/,
- 2/*if_icmpne*/, 2/*if_icmplt*/, 2/*if_icmpge*/, 2/*if_icmpgt*/,
- 2/*if_icmple*/, 2/*if_acmpeq*/, 2/*if_acmpne*/, 2/*goto*/,
- 2/*jsr*/, 1/*ret*/, UNPREDICTABLE/*tableswitch*/, UNPREDICTABLE/*lookupswitch*/,
- 0/*ireturn*/, 0/*lreturn*/, 0/*freturn*/,
- 0/*dreturn*/, 0/*areturn*/, 0/*return*/,
- 2/*getstatic*/, 2/*putstatic*/, 2/*getfield*/,
- 2/*putfield*/, 2/*invokevirtual*/, 2/*invokespecial*/, 2/*invokestatic*/,
- 4/*invokeinterface*/, UNDEFINED, 2/*new*/,
- 1/*newarray*/, 2/*anewarray*/,
- 0/*arraylength*/, 0/*athrow*/, 2/*checkcast*/,
- 2/*instanceof*/, 0/*monitorenter*/,
- 0/*monitorexit*/, UNPREDICTABLE/*wide*/, 3/*multianewarray*/,
- 2/*ifnull*/, 2/*ifnonnull*/, 4/*goto_w*/,
- 4/*jsr_w*/, 0/*breakpoint*/, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED, UNDEFINED,
- UNDEFINED, UNDEFINED, RESERVED/*impdep1*/, RESERVED/*impdep2*/
- };
-
- /**
- * How the byte code operands are to be interpreted for each opcode.
- * Indexed by opcode. TYPE_OF_OPERANDS[ILOAD] = an array of shorts
- * describing the data types for the instruction.
- */
- public static final short[][] TYPE_OF_OPERANDS = {
- {}/*nop*/, {}/*aconst_null*/, {}/*iconst_m1*/, {}/*iconst_0*/,
- {}/*iconst_1*/, {}/*iconst_2*/, {}/*iconst_3*/, {}/*iconst_4*/,
- {}/*iconst_5*/, {}/*lconst_0*/, {}/*lconst_1*/, {}/*fconst_0*/,
- {}/*fconst_1*/, {}/*fconst_2*/, {}/*dconst_0*/, {}/*dconst_1*/,
- {T_BYTE}/*bipush*/, {T_SHORT}/*sipush*/, {T_BYTE}/*ldc*/,
- {T_SHORT}/*ldc_w*/, {T_SHORT}/*ldc2_w*/,
- {T_BYTE}/*iload*/, {T_BYTE}/*lload*/, {T_BYTE}/*fload*/,
- {T_BYTE}/*dload*/, {T_BYTE}/*aload*/, {}/*iload_0*/,
- {}/*iload_1*/, {}/*iload_2*/, {}/*iload_3*/, {}/*lload_0*/,
- {}/*lload_1*/, {}/*lload_2*/, {}/*lload_3*/, {}/*fload_0*/,
- {}/*fload_1*/, {}/*fload_2*/, {}/*fload_3*/, {}/*dload_0*/,
- {}/*dload_1*/, {}/*dload_2*/, {}/*dload_3*/, {}/*aload_0*/,
- {}/*aload_1*/, {}/*aload_2*/, {}/*aload_3*/, {}/*iaload*/,
- {}/*laload*/, {}/*faload*/, {}/*daload*/, {}/*aaload*/,
- {}/*baload*/, {}/*caload*/, {}/*saload*/, {T_BYTE}/*istore*/,
- {T_BYTE}/*lstore*/, {T_BYTE}/*fstore*/, {T_BYTE}/*dstore*/,
- {T_BYTE}/*astore*/, {}/*istore_0*/, {}/*istore_1*/,
- {}/*istore_2*/, {}/*istore_3*/, {}/*lstore_0*/, {}/*lstore_1*/,
- {}/*lstore_2*/, {}/*lstore_3*/, {}/*fstore_0*/, {}/*fstore_1*/,
- {}/*fstore_2*/, {}/*fstore_3*/, {}/*dstore_0*/, {}/*dstore_1*/,
- {}/*dstore_2*/, {}/*dstore_3*/, {}/*astore_0*/, {}/*astore_1*/,
- {}/*astore_2*/, {}/*astore_3*/, {}/*iastore*/, {}/*lastore*/,
- {}/*fastore*/, {}/*dastore*/, {}/*aastore*/, {}/*bastore*/,
- {}/*castore*/, {}/*sastore*/, {}/*pop*/, {}/*pop2*/, {}/*dup*/,
- {}/*dup_x1*/, {}/*dup_x2*/, {}/*dup2*/, {}/*dup2_x1*/,
- {}/*dup2_x2*/, {}/*swap*/, {}/*iadd*/, {}/*ladd*/, {}/*fadd*/,
- {}/*dadd*/, {}/*isub*/, {}/*lsub*/, {}/*fsub*/, {}/*dsub*/,
- {}/*imul*/, {}/*lmul*/, {}/*fmul*/, {}/*dmul*/, {}/*idiv*/,
- {}/*ldiv*/, {}/*fdiv*/, {}/*ddiv*/, {}/*irem*/, {}/*lrem*/,
- {}/*frem*/, {}/*drem*/, {}/*ineg*/, {}/*lneg*/, {}/*fneg*/,
- {}/*dneg*/, {}/*ishl*/, {}/*lshl*/, {}/*ishr*/, {}/*lshr*/,
- {}/*iushr*/, {}/*lushr*/, {}/*iand*/, {}/*land*/, {}/*ior*/,
- {}/*lor*/, {}/*ixor*/, {}/*lxor*/, {T_BYTE, T_BYTE}/*iinc*/,
- {}/*i2l*/, {}/*i2f*/, {}/*i2d*/, {}/*l2i*/, {}/*l2f*/, {}/*l2d*/,
- {}/*f2i*/, {}/*f2l*/, {}/*f2d*/, {}/*d2i*/, {}/*d2l*/, {}/*d2f*/,
- {}/*i2b*/, {}/*i2c*/,{}/*i2s*/, {}/*lcmp*/, {}/*fcmpl*/,
- {}/*fcmpg*/, {}/*dcmpl*/, {}/*dcmpg*/, {T_SHORT}/*ifeq*/,
- {T_SHORT}/*ifne*/, {T_SHORT}/*iflt*/, {T_SHORT}/*ifge*/,
- {T_SHORT}/*ifgt*/, {T_SHORT}/*ifle*/, {T_SHORT}/*if_icmpeq*/,
- {T_SHORT}/*if_icmpne*/, {T_SHORT}/*if_icmplt*/,
- {T_SHORT}/*if_icmpge*/, {T_SHORT}/*if_icmpgt*/,
- {T_SHORT}/*if_icmple*/, {T_SHORT}/*if_acmpeq*/,
- {T_SHORT}/*if_acmpne*/, {T_SHORT}/*goto*/, {T_SHORT}/*jsr*/,
- {T_BYTE}/*ret*/, {}/*tableswitch*/, {}/*lookupswitch*/,
- {}/*ireturn*/, {}/*lreturn*/, {}/*freturn*/, {}/*dreturn*/,
- {}/*areturn*/, {}/*return*/, {T_SHORT}/*getstatic*/,
- {T_SHORT}/*putstatic*/, {T_SHORT}/*getfield*/,
- {T_SHORT}/*putfield*/, {T_SHORT}/*invokevirtual*/,
- {T_SHORT}/*invokespecial*/, {T_SHORT}/*invokestatic*/,
- {T_SHORT, T_BYTE, T_BYTE}/*invokeinterface*/, {},
- {T_SHORT}/*new*/, {T_BYTE}/*newarray*/,
- {T_SHORT}/*anewarray*/, {}/*arraylength*/, {}/*athrow*/,
- {T_SHORT}/*checkcast*/, {T_SHORT}/*instanceof*/,
- {}/*monitorenter*/, {}/*monitorexit*/, {T_BYTE}/*wide*/,
- {T_SHORT, T_BYTE}/*multianewarray*/, {T_SHORT}/*ifnull*/,
- {T_SHORT}/*ifnonnull*/, {T_INT}/*goto_w*/, {T_INT}/*jsr_w*/,
- {}/*breakpoint*/, {}, {}, {}, {}, {}, {}, {},
- {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
- {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
- {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {},
- {}/*impdep1*/, {}/*impdep2*/
- };
-
- /**
- * Names of opcodes. Indexed by opcode. OPCODE_NAMES[ALOAD] = "aload".
- */
- public static final String[] OPCODE_NAMES = {
- "nop", "aconst_null", "iconst_m1", "iconst_0", "iconst_1",
- "iconst_2", "iconst_3", "iconst_4", "iconst_5", "lconst_0",
- "lconst_1", "fconst_0", "fconst_1", "fconst_2", "dconst_0",
- "dconst_1", "bipush", "sipush", "ldc", "ldc_w", "ldc2_w", "iload",
- "lload", "fload", "dload", "aload", "iload_0", "iload_1", "iload_2",
- "iload_3", "lload_0", "lload_1", "lload_2", "lload_3", "fload_0",
- "fload_1", "fload_2", "fload_3", "dload_0", "dload_1", "dload_2",
- "dload_3", "aload_0", "aload_1", "aload_2", "aload_3", "iaload",
- "laload", "faload", "daload", "aaload", "baload", "caload", "saload",
- "istore", "lstore", "fstore", "dstore", "astore", "istore_0",
- "istore_1", "istore_2", "istore_3", "lstore_0", "lstore_1",
- "lstore_2", "lstore_3", "fstore_0", "fstore_1", "fstore_2",
- "fstore_3", "dstore_0", "dstore_1", "dstore_2", "dstore_3",
- "astore_0", "astore_1", "astore_2", "astore_3", "iastore", "lastore",
- "fastore", "dastore", "aastore", "bastore", "castore", "sastore",
- "pop", "pop2", "dup", "dup_x1", "dup_x2", "dup2", "dup2_x1",
- "dup2_x2", "swap", "iadd", "ladd", "fadd", "dadd", "isub", "lsub",
- "fsub", "dsub", "imul", "lmul", "fmul", "dmul", "idiv", "ldiv",
- "fdiv", "ddiv", "irem", "lrem", "frem", "drem", "ineg", "lneg",
- "fneg", "dneg", "ishl", "lshl", "ishr", "lshr", "iushr", "lushr",
- "iand", "land", "ior", "lor", "ixor", "lxor", "iinc", "i2l", "i2f",
- "i2d", "l2i", "l2f", "l2d", "f2i", "f2l", "f2d", "d2i", "d2l", "d2f",
- "i2b", "i2c", "i2s", "lcmp", "fcmpl", "fcmpg",
- "dcmpl", "dcmpg", "ifeq", "ifne", "iflt", "ifge", "ifgt", "ifle",
- "if_icmpeq", "if_icmpne", "if_icmplt", "if_icmpge", "if_icmpgt",
- "if_icmple", "if_acmpeq", "if_acmpne", "goto", "jsr", "ret",
- "tableswitch", "lookupswitch", "ireturn", "lreturn", "freturn",
- "dreturn", "areturn", "return", "getstatic", "putstatic", "getfield",
- "putfield", "invokevirtual", "invokespecial", "invokestatic",
- "invokeinterface", ILLEGAL_OPCODE, "new", "newarray", "anewarray",
- "arraylength", "athrow", "checkcast", "instanceof", "monitorenter",
- "monitorexit", "wide", "multianewarray", "ifnull", "ifnonnull",
- "goto_w", "jsr_w", "breakpoint", ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE, ILLEGAL_OPCODE,
- ILLEGAL_OPCODE, "impdep1", "impdep2"
- };
-
/** Attributes and their corresponding names.
*/
@@ -536,11 +136,6 @@ public interface Constants {
public static final byte ITEM_Object = 7;
public static final byte ITEM_NewObject = 8;
- public static final String[] ITEM_NAMES = {
- "Bogus", "Integer", "Float", "Double", "Long",
- "Null", "InitObject", "Object", "NewObject"
- };
-
/** Constants used to identify StackMapEntry types.
*
* For those types which can specify a range, the
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.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 the default value of a annotation for a method info
*
@@ -66,13 +64,6 @@ public class AnnotationDefault extends A
public AnnotationDefault(int name_index, int length,
ElementValue defaultValue, ConstantPool constant_pool)
{
- super(Constants.ATTR_ANNOTATION_DEFAULT, name_index, length, constant_pool);
- }
-
-
- @Override
- public Attribute copy(ConstantPool _constant_pool)
- {
- throw new RuntimeException("Not implemented yet!");
+ super(name_index, length, constant_pool);
}
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.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;
-
public class AnnotationElementValue extends ElementValue
{
// For annotation element values, this is the annotation
@@ -36,24 +33,11 @@ public class AnnotationElementValue exte
}
@Override
- public void dump(DataOutputStream dos) throws IOException
- {
- dos.writeByte(type); // u1 type of value (ANNOTATION == '@')
- annotationEntry.dump(dos);
- }
-
- @Override
public String stringifyValue()
{
return annotationEntry.toString();
}
- @Override
- public String toString()
- {
- return stringifyValue();
- }
-
public AnnotationEntry getAnnotationEntry()
{
return annotationEntry;
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.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.util.ArrayList;
import java.util.List;
@@ -79,14 +78,4 @@ public class AnnotationEntry implements
// TODO return List
return element_value_pairs.toArray(new ElementValuePair[element_value_pairs.size()]);
}
-
- public void dump(DataOutputStream dos) throws IOException {
- dos.writeShort(type_index); // u2 index of type name in cpool
- dos.writeShort(element_value_pairs.size()); // u2 element_value pair
- // count
- for (int i = 0; i < element_value_pairs.size(); i++) {
- final ElementValuePair envp = element_value_pairs.get(i);
- envp.dump(dos);
- }
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Annotations.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Annotations.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Annotations.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;
/**
@@ -35,14 +34,13 @@ public abstract class Annotations extend
private AnnotationEntry[] annotation_table;
/**
- * @param annotation_type the subclass type of the 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
*/
- public Annotations(byte annotation_type, int name_index, int length, DataInputStream file, ConstantPool constant_pool) throws IOException {
- this(annotation_type, name_index, length, (AnnotationEntry[]) null, constant_pool);
+ public Annotations(int name_index, int length, DataInputStream file, ConstantPool constant_pool) throws IOException {
+ this(name_index, length, (AnnotationEntry[]) null, constant_pool);
final int annotation_table_length = (file.readUnsignedShort());
annotation_table = new AnnotationEntry[annotation_table_length];
for (int i = 0; i < annotation_table_length; i++) {
@@ -52,14 +50,13 @@ public abstract class Annotations extend
/**
- * @param annotation_type the subclass type of the annotation
* @param name_index Index pointing to the name <em>Code</em>
* @param length Content length in bytes
* @param annotation_table the actual annotations
* @param constant_pool Array of constants
*/
- public Annotations(byte annotation_type, int name_index, int length, AnnotationEntry[] annotation_table, ConstantPool constant_pool) {
- super(annotation_type, name_index, length, constant_pool);
+ public Annotations(int name_index, int length, AnnotationEntry[] annotation_table, ConstantPool constant_pool) {
+ super(name_index, length, constant_pool);
setAnnotationTable(annotation_table);
}
@@ -76,14 +73,4 @@ public abstract class Annotations extend
public AnnotationEntry[] getAnnotationEntries() {
return annotation_table;
}
-
- protected void writeAnnotations(DataOutputStream dos) throws IOException {
- if (annotation_table == null) {
- return;
- }
- dos.writeShort(annotation_table.length);
- for (int i = 0; i < annotation_table.length; i++) {
- annotation_table[i].dump(dos);
- }
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java Tue Oct 23 11:34:15 2012
@@ -17,29 +17,11 @@
*/
package org.apache.tomcat.util.bcel.classfile;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
public class ArrayElementValue extends ElementValue
{
// For array types, this is the array
private ElementValue[] evalues;
- @Override
- public String toString()
- {
- StringBuilder sb = new StringBuilder();
- sb.append("{");
- for (int i = 0; i < evalues.length; i++)
- {
- sb.append(evalues[i].toString());
- if ((i + 1) < evalues.length)
- sb.append(",");
- }
- sb.append("}");
- return sb.toString();
- }
-
public ArrayElementValue(int type, ElementValue[] datums, ConstantPool cpool)
{
super(type, cpool);
@@ -50,17 +32,6 @@ public class ArrayElementValue extends E
}
@Override
- public void dump(DataOutputStream dos) throws IOException
- {
- dos.writeByte(type); // u1 type of value (ARRAY == '[')
- dos.writeShort(evalues.length);
- for (int i = 0; i < evalues.length; i++)
- {
- evalues[i].dump(dos);
- }
- }
-
- @Override
public String stringifyValue()
{
StringBuilder sb = new StringBuilder();
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Attribute.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Attribute.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Attribute.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 java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
import org.apache.tomcat.util.bcel.Constants;
@@ -55,21 +53,16 @@ public abstract class Attribute implemen
protected int length; // Content length of attribute field
- protected byte tag; // Tag to distiguish subclasses
-
protected ConstantPool constant_pool;
- protected Attribute(byte tag, int name_index, int length,
+ protected Attribute(int name_index, int length,
ConstantPool constant_pool)
{
- this.tag = tag;
this.name_index = name_index;
this.length = length;
this.constant_pool = constant_pool;
}
- private static final Map<String,AttributeReader> readers = new HashMap<>();
-
/*
* Class method reads one attribute from the input data stream. This method
* must not be accessible from the outside. It is called by the Field and
@@ -110,12 +103,6 @@ public abstract class Attribute implemen
switch (tag)
{
case Constants.ATTR_UNKNOWN:
- AttributeReader r = readers.get(name);
- if (r != null)
- {
- return r.createAttribute(name_index, length, file,
- constant_pool);
- }
return new Unknown(name_index, length, file, constant_pool);
case Constants.ATTR_CONSTANT_VALUE:
return new ConstantValue(name_index, length, file, constant_pool);
@@ -181,16 +168,6 @@ public abstract class Attribute implemen
/**
- * @return Tag of attribute, i.e., its type. Value may not be altered, thus
- * there is no setTag() method.
- */
- public final byte getTag()
- {
- return tag;
- }
-
-
- /**
* Use copy() if you want to have a deep copy(), i.e., with all references
* copied correctly.
*
@@ -210,18 +187,4 @@ public abstract class Attribute implemen
}
return o;
}
-
- /**
- * @return deep copy of this attribute
- */
- public abstract Attribute copy(ConstantPool _constant_pool);
-
- /**
- * @return attribute name.
- */
- @Override
- public String toString()
- {
- return Constants.ATTRIBUTE_NAMES[tag];
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.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 ClassElementValue extends ElementValue
@@ -43,11 +40,4 @@ public class ClassElementValue extends E
Constants.CONSTANT_Utf8);
return cu8.getBytes();
}
-
- @Override
- public void dump(DataOutputStream dos) throws IOException
- {
- dos.writeByte(type); // u1 kind of value
- dos.writeShort(idx);
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ClassFormatException.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ClassFormatException.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ClassFormatException.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ClassFormatException.java Tue Oct 23 11:34:15 2012
@@ -37,8 +37,4 @@ public class ClassFormatException extend
public ClassFormatException(String s) {
super(s);
}
-
- public ClassFormatException(String s, Throwable initCause) {
- super(s, initCause);
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java Tue Oct 23 11:34:15 2012
@@ -44,12 +44,11 @@ public final class ClassParser {
private DataInputStream file;
private String file_name;
private int class_name_index, superclass_name_index;
- private int major, minor; // Compiler version
private int access_flags; // Access rights of parsed class
private int[] interfaces; // Names of implemented interfaces
private ConstantPool constant_pool; // collection of constants
- private Field[] fields; // class fields, i.e., its variables
- private Method[] methods; // methods defined in the class
+ private FieldOrMethod[] fields; // class fields, i.e., its variables
+ private FieldOrMethod[] methods; // methods defined in the class
private Attribute[] attributes; // attributes defined in the class
private static final int BUFSIZE = 8192;
@@ -117,8 +116,8 @@ public final class ClassParser {
// }
// Return the information we have gathered in a new object
- return new JavaClass(class_name_index, superclass_name_index, file_name, major, minor,
- access_flags, constant_pool, interfaces, fields, methods, attributes);
+ return new JavaClass(class_name_index, superclass_name_index,
+ access_flags, constant_pool, interfaces, attributes);
}
@@ -177,9 +176,9 @@ public final class ClassParser {
private final void readFields() throws IOException, ClassFormatException {
int fields_count;
fields_count = file.readUnsignedShort();
- fields = new Field[fields_count];
+ fields = new FieldOrMethod[fields_count];
for (int i = 0; i < fields_count; i++) {
- fields[i] = new Field(file, constant_pool);
+ fields[i] = new FieldOrMethod(file, constant_pool);
}
}
@@ -222,9 +221,9 @@ public final class ClassParser {
private final void readMethods() throws IOException, ClassFormatException {
int methods_count;
methods_count = file.readUnsignedShort();
- methods = new Method[methods_count];
+ methods = new FieldOrMethod[methods_count];
for (int i = 0; i < methods_count; i++) {
- methods[i] = new Method(file, constant_pool);
+ methods[i] = new FieldOrMethod(file, constant_pool);
}
}
@@ -235,7 +234,7 @@ public final class ClassParser {
* @throws ClassFormatException
*/
private final void readVersion() throws IOException, ClassFormatException {
- minor = file.readUnsignedShort();
- major = file.readUnsignedShort();
+ file.readUnsignedShort(); // Unused minor
+ file.readUnsignedShort(); // Unused major
}
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Code.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Code.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Code.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Code.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 chunk of Java byte code contained in a
* method. It is instantiated by the
@@ -37,19 +35,15 @@ import org.apache.tomcat.util.bcel.Const
* @version $Id$
* @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
* @see Attribute
- * @see CodeException
* @see LineNumberTable
* @see LocalVariableTable
*/
public final class Code extends Attribute {
private static final long serialVersionUID = 8936843273318969602L;
- private int max_stack; // Maximum size of stack used by this method
- private int max_locals; // Number of local variables
private int code_length; // Length of code in bytes
private byte[] code; // Actual byte code
private int exception_table_length;
- private CodeException[] exception_table; // Table of handled exceptions
private int attributes_count; // Attributes of code: LineNumber
private Attribute[] attributes; // or LocalVariable
@@ -63,8 +57,10 @@ public final class Code extends Attribut
Code(int name_index, int length, DataInputStream file, ConstantPool constant_pool)
throws IOException {
// Initialize with some default values which will be overwritten later
- this(name_index, length, file.readUnsignedShort(), file.readUnsignedShort(), (byte[]) null,
- (CodeException[]) null, (Attribute[]) null, constant_pool);
+ this(name_index, length, (byte[]) null, (Attribute[]) null,
+ constant_pool);
+ file.readUnsignedShort(); // Unused max_stack
+ file.readUnsignedShort(); // Unused max_locals
code_length = file.readInt();
code = new byte[code_length]; // Read byte code
file.readFully(code);
@@ -72,9 +68,8 @@ public final class Code extends Attribut
* handler is active, i.e., a try { ... } catch() block.
*/
exception_table_length = file.readUnsignedShort();
- exception_table = new CodeException[exception_table_length];
for (int i = 0; i < exception_table_length; i++) {
- exception_table[i] = new CodeException(file);
+ Utility.swallowCodeException(file);
}
/* Read all attributes, currently `LineNumberTable' and
* `LocalVariableTable'
@@ -95,38 +90,19 @@ public final class Code extends Attribut
/**
* @param name_index Index pointing to the name <em>Code</em>
* @param length Content length in bytes
- * @param max_stack Maximum size of stack
- * @param max_locals Number of local variables
* @param code Actual byte code
- * @param exception_table Table of handled exceptions
* @param attributes Attributes of code: LineNumber or LocalVariable
* @param constant_pool Array of constants
*/
- public Code(int name_index, int length, int max_stack, int max_locals, byte[] code,
- CodeException[] exception_table, Attribute[] attributes, ConstantPool constant_pool) {
- super(Constants.ATTR_CODE, name_index, length, constant_pool);
- this.max_stack = max_stack;
- this.max_locals = max_locals;
+ public Code(int name_index, int length, byte[] code,
+ Attribute[] attributes, ConstantPool constant_pool) {
+ super(name_index, length, constant_pool);
setCode(code);
- setExceptionTable(exception_table);
setAttributes(attributes); // Overwrites length!
}
/**
- * @return LocalVariableTable of Code, if it has one
- */
- public LocalVariableTable getLocalVariableTable() {
- for (int i = 0; i < attributes_count; i++) {
- if (attributes[i] instanceof LocalVariableTable) {
- return (LocalVariableTable) attributes[i];
- }
- }
- return null;
- }
-
-
- /**
* @return the internal length of this code attribute (minus the first 6 bytes)
* and excluding all its attributes
*/
@@ -170,72 +146,4 @@ public final class Code extends Attribut
code_length = (code == null) ? 0 : code.length;
length = calculateLength(); // Adjust length
}
-
-
- /**
- * @param exception_table exception table
- */
- public final void setExceptionTable( CodeException[] exception_table ) {
- this.exception_table = exception_table;
- exception_table_length = (exception_table == null) ? 0 : exception_table.length;
- length = calculateLength(); // Adjust length
- }
-
-
- /**
- * @return String representation of code chunk.
- */
- public final String toString( boolean verbose ) {
- StringBuilder buf = new StringBuilder(100);
- buf.append("Code(max_stack = ").append(max_stack).append(", max_locals = ").append(
- max_locals).append(", code_length = ").append(code_length).append(")\n").append(
- Utility.codeToString(code, constant_pool, 0, -1, verbose));
- if (exception_table_length > 0) {
- buf.append("\nException handler(s) = \n").append("From\tTo\tHandler\tType\n");
- for (int i = 0; i < exception_table_length; i++) {
- buf.append(exception_table[i].toString(constant_pool, verbose)).append("\n");
- }
- }
- if (attributes_count > 0) {
- buf.append("\nAttribute(s) = \n");
- for (int i = 0; i < attributes_count; i++) {
- buf.append(attributes[i].toString()).append("\n");
- }
- }
- return buf.toString();
- }
-
-
- /**
- * @return String representation of code chunk.
- */
- @Override
- public final String toString() {
- return toString(true);
- }
-
-
- /**
- * @return deep copy of this attribute
- *
- * @param _constant_pool the constant pool to duplicate
- */
- @Override
- public Attribute copy( ConstantPool _constant_pool ) {
- Code c = (Code) clone();
- if (code != null) {
- c.code = new byte[code.length];
- System.arraycopy(code, 0, c.code, 0, code.length);
- }
- c.constant_pool = _constant_pool;
- c.exception_table = new CodeException[exception_table_length];
- for (int i = 0; i < exception_table_length; i++) {
- c.exception_table[i] = exception_table[i].copy();
- }
- c.attributes = new Attribute[attributes_count];
- for (int i = 0; i < attributes_count; i++) {
- c.attributes[i] = attributes[i].copy(_constant_pool);
- }
- return c;
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Constant.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Constant.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Constant.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Constant.java Tue Oct 23 11:34:15 2012
@@ -76,15 +76,6 @@ public abstract class Constant implement
}
- /**
- * @return String representation.
- */
- @Override
- public String toString() {
- return Constants.CONSTANT_NAMES[tag] + "[" + tag + "]";
- }
-
-
@Override
public Object clone() throws CloneNotSupportedException {
return super.clone();
@@ -135,6 +126,13 @@ public abstract class Constant implement
}
+
+ @Override
+ public String toString() {
+ return "[" + tag + "]";
+ }
+
+
/**
* Return value as defined by given BCELComparator strategy.
* By default two Constant objects are said to be equal when
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantCP.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantCP.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantCP.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantCP.java Tue Oct 23 11:34:15 2012
@@ -74,14 +74,4 @@ public abstract class ConstantCP extends
public final int getNameAndTypeIndex() {
return name_and_type_index;
}
-
-
- /**
- * @return String representation.
- */
- @Override
- public final String toString() {
- return super.toString() + "(class_index = " + class_index + ", name_and_type_index = "
- + name_and_type_index + ")";
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java Tue Oct 23 11:34:15 2012
@@ -64,13 +64,4 @@ public final class ConstantClass extends
public final int getNameIndex() {
return name_index;
}
-
-
- /**
- * @return String representation.
- */
- @Override
- public final String toString() {
- return super.toString() + "(name_index = " + name_index + ")";
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java Tue Oct 23 11:34:15 2012
@@ -63,13 +63,4 @@ public final class ConstantDouble extend
public final double getBytes() {
return bytes;
}
-
-
- /**
- * @return String representation.
- */
- @Override
- public final String toString() {
- return super.toString() + "(bytes = " + bytes + ")";
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java Tue Oct 23 11:34:15 2012
@@ -63,13 +63,4 @@ public final class ConstantFloat extends
public final float getBytes() {
return bytes;
}
-
-
- /**
- * @return String representation.
- */
- @Override
- public final String toString() {
- return super.toString() + "(bytes = " + bytes + ")";
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java Tue Oct 23 11:34:15 2012
@@ -63,13 +63,4 @@ public final class ConstantInteger exten
public final int getBytes() {
return bytes;
}
-
-
- /**
- * @return String representation.
- */
- @Override
- public final String toString() {
- return super.toString() + "(bytes = " + bytes + ")";
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantInvokeDynamic.java Tue Oct 23 11:34:15 2012
@@ -32,16 +32,6 @@ import org.apache.tomcat.util.bcel.Const
public final class ConstantInvokeDynamic extends Constant {
private static final long serialVersionUID = 4310367359017396174L;
- private int bootstrap_method_attr_index;
- private int name_and_type_index;
-
-
- /**
- * Initialize from another object.
- */
- public ConstantInvokeDynamic(ConstantInvokeDynamic c) {
- this(c.getBootstrapMethodAttrIndex(), c.getNameAndTypeIndex());
- }
/**
@@ -51,45 +41,8 @@ public final class ConstantInvokeDynamic
* @throws IOException
*/
ConstantInvokeDynamic(DataInput file) throws IOException {
- this(file.readUnsignedShort(), file.readUnsignedShort());
- }
-
-
- public ConstantInvokeDynamic(int bootstrap_method_attr_index,
- int name_and_type_index) {
super(Constants.CONSTANT_InvokeDynamic);
- this.bootstrap_method_attr_index = bootstrap_method_attr_index;
- this.name_and_type_index = name_and_type_index;
- }
-
-
- public int getBootstrapMethodAttrIndex() {
- return bootstrap_method_attr_index;
- }
-
-
- public void setBootstrapMethodAttrIndex(int bootstrap_method_attr_index) {
- this.bootstrap_method_attr_index = bootstrap_method_attr_index;
- }
-
-
- public int getNameAndTypeIndex() {
- return name_and_type_index;
- }
-
-
- public void setNameAndTypeIndex(int name_and_type_index) {
- this.name_and_type_index = name_and_type_index;
- }
-
-
- /**
- * @return String representation
- */
- @Override
- public final String toString() {
- return super.toString() + "(bootstrap_method_attr_index = " +
- bootstrap_method_attr_index + ", name_and_type_index = " +
- name_and_type_index + ")";
+ file.readUnsignedShort(); // Unused bootstrap_method_attr_index
+ file.readUnsignedShort(); // Unused name_and_type_index
}
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java Tue Oct 23 11:34:15 2012
@@ -63,13 +63,4 @@ public final class ConstantLong extends
public final long getBytes() {
return bytes;
}
-
-
- /**
- * @return String representation.
- */
- @Override
- public final String toString() {
- return super.toString() + "(bytes = " + bytes + ")";
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodHandle.java Tue Oct 23 11:34:15 2012
@@ -32,16 +32,6 @@ import org.apache.tomcat.util.bcel.Const
public final class ConstantMethodHandle extends Constant {
private static final long serialVersionUID = -7875124116920198044L;
- private int reference_kind;
- private int reference_index;
-
-
- /**
- * Initialize from another object.
- */
- public ConstantMethodHandle(ConstantMethodHandle c) {
- this(c.getReferenceKind(), c.getReferenceIndex());
- }
/**
@@ -51,43 +41,8 @@ public final class ConstantMethodHandle
* @throws IOException
*/
ConstantMethodHandle(DataInput file) throws IOException {
- this(file.readUnsignedByte(), file.readUnsignedShort());
- }
-
-
- public ConstantMethodHandle(int reference_kind, int reference_index) {
super(Constants.CONSTANT_MethodHandle);
- this.reference_kind = reference_kind;
- this.reference_index = reference_index;
- }
-
-
- public int getReferenceKind() {
- return reference_kind;
- }
-
-
- public void setReferenceKind(int reference_kind) {
- this.reference_kind = reference_kind;
- }
-
-
- public int getReferenceIndex() {
- return reference_index;
- }
-
-
- public void setReferenceIndex(int reference_index) {
- this.reference_index = reference_index;
- }
-
-
- /**
- * @return String representation
- */
- @Override
- public final String toString() {
- return super.toString() + "(reference_kind = " + reference_kind +
- ", reference_index = " + reference_index + ")";
+ file.readUnsignedByte(); // Unused reference_kind
+ file.readUnsignedShort(); // Unused reference_index
}
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantMethodType.java Tue Oct 23 11:34:15 2012
@@ -32,15 +32,6 @@ import org.apache.tomcat.util.bcel.Const
public final class ConstantMethodType extends Constant {
private static final long serialVersionUID = 6750768220616618881L;
- private int descriptor_index;
-
-
- /**
- * Initialize from another object.
- */
- public ConstantMethodType(ConstantMethodType c) {
- this(c.getDescriptorIndex());
- }
/**
@@ -50,31 +41,7 @@ public final class ConstantMethodType ex
* @throws IOException
*/
ConstantMethodType(DataInput file) throws IOException {
- this(file.readUnsignedShort());
- }
-
-
- public ConstantMethodType(int descriptor_index) {
super(Constants.CONSTANT_MethodType);
- this.descriptor_index = descriptor_index;
- }
-
-
- public int getDescriptorIndex() {
- return descriptor_index;
- }
-
-
- public void setDescriptorIndex(int descriptor_index) {
- this.descriptor_index = descriptor_index;
- }
-
-
- /**
- * @return String representation
- */
- @Override
- public final String toString() {
- return super.toString() + "(descriptor_index = " + descriptor_index + ")";
+ file.readUnsignedShort(); // Unused descriptor_index
}
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantNameAndType.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantNameAndType.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantNameAndType.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantNameAndType.java Tue Oct 23 11:34:15 2012
@@ -75,14 +75,4 @@ public final class ConstantNameAndType e
public final int getSignatureIndex() {
return signature_index;
}
-
-
- /**
- * @return String representation
- */
- @Override
- public final String toString() {
- return super.toString() + "(name_index = " + name_index + ", signature_index = "
- + signature_index + ")";
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantPool.java Tue Oct 23 11:34:15 2012
@@ -250,27 +250,4 @@ public class ConstantPool implements Clo
c = getConstant(i, Constants.CONSTANT_Utf8);
return ((ConstantUtf8) c).getBytes();
}
-
-
- /**
- * @return Length of constant pool.
- */
- public int getLength() {
- return constant_pool_count;
- }
-
-
- /**
- * @return String representation.
- */
- @Override
- public String toString() {
- StringBuilder buf = new StringBuilder();
- for (int i = 1; i < constant_pool_count; i++) {
- buf.append(i).append(")").append(constant_pool[i]).append("\n");
- }
- return buf.toString();
- }
-
-
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantString.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantString.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantString.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantString.java Tue Oct 23 11:34:15 2012
@@ -63,13 +63,4 @@ public final class ConstantString extend
public final int getStringIndex() {
return string_index;
}
-
-
- /**
- * @return String representation.
- */
- @Override
- public final String toString() {
- return super.toString() + "(string_index = " + string_index + ")";
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantUtf8.java Tue Oct 23 11:34:15 2012
@@ -54,13 +54,4 @@ public final class ConstantUtf8 extends
public final String getBytes() {
return bytes;
}
-
-
- /**
- * @return String representation
- */
- @Override
- public final String toString() {
- return super.toString() + "(\"" + Utility.replace(bytes, "\n", "\\n") + "\")";
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ConstantValue.java Tue Oct 23 11:34:15 2012
@@ -19,8 +19,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 constant
* value, i.e., a default value for initializing a class field.
@@ -33,7 +31,6 @@ import org.apache.tomcat.util.bcel.Const
public final class ConstantValue extends Attribute {
private static final long serialVersionUID = -388222612752527969L;
- private int constantvalue_index;
/**
@@ -46,64 +43,7 @@ public final class ConstantValue extends
*/
ConstantValue(int name_index, int length, DataInput file, ConstantPool constant_pool)
throws IOException {
- this(name_index, length, file.readUnsignedShort(), constant_pool);
- }
-
-
- /**
- * @param name_index Name index in constant pool
- * @param length Content length in bytes
- * @param constantvalue_index Index in constant pool
- * @param constant_pool Array of constants
- */
- public ConstantValue(int name_index, int length, int constantvalue_index,
- ConstantPool constant_pool) {
- super(Constants.ATTR_CONSTANT_VALUE, name_index, length, constant_pool);
- this.constantvalue_index = constantvalue_index;
- }
-
-
- /**
- * @return String representation of constant value.
- */
- @Override
- public final String toString() {
- Constant c = constant_pool.getConstant(constantvalue_index);
- String buf;
- int i;
- // Print constant to string depending on its type
- switch (c.getTag()) {
- case Constants.CONSTANT_Long:
- buf = String.valueOf(((ConstantLong) c).getBytes());
- break;
- case Constants.CONSTANT_Float:
- buf = String.valueOf(((ConstantFloat) c).getBytes());
- break;
- case Constants.CONSTANT_Double:
- buf = String.valueOf(((ConstantDouble) c).getBytes());
- break;
- case Constants.CONSTANT_Integer:
- buf = String.valueOf(((ConstantInteger) c).getBytes());
- break;
- case Constants.CONSTANT_String:
- i = ((ConstantString) c).getStringIndex();
- c = constant_pool.getConstant(i, Constants.CONSTANT_Utf8);
- buf = "\"" + Utility.convertString(((ConstantUtf8) c).getBytes()) + "\"";
- break;
- default:
- throw new IllegalStateException("Type of ConstValue invalid: " + c);
- }
- return buf;
- }
-
-
- /**
- * @return deep copy of this attribute
- */
- @Override
- public Attribute copy( ConstantPool _constant_pool ) {
- ConstantValue c = (ConstantValue) clone();
- c.constant_pool = _constant_pool;
- return c;
+ super(name_index, length, constant_pool);
+ file.readUnsignedShort(); // Unused constantvalue_index
}
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Deprecated.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Deprecated.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Deprecated.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/Deprecated.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 is a
* deprecated method.
@@ -44,7 +42,7 @@ public final class Deprecated extends At
* @param constant_pool Array of constants
*/
public Deprecated(int name_index, int length, byte[] bytes, ConstantPool constant_pool) {
- super(Constants.ATTR_DEPRECATED, name_index, length, constant_pool);
+ super(name_index, length, constant_pool);
this.bytes = bytes;
}
@@ -66,28 +64,4 @@ public final class Deprecated extends At
System.err.println("Deprecated attribute with length > 0");
}
}
-
-
- /**
- * @return attribute name
- */
- @Override
- public final String toString() {
- return Constants.ATTRIBUTE_NAMES[Constants.ATTR_DEPRECATED];
- }
-
-
- /**
- * @return deep copy of this attribute
- */
- @Override
- public Attribute copy( ConstantPool _constant_pool ) {
- Deprecated c = (Deprecated) 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/ElementValue.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ElementValue.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;
/**
@@ -32,11 +31,6 @@ public abstract class ElementValue
protected ConstantPool cpool;
- @Override
- public String toString()
- {
- return stringifyValue();
- }
protected ElementValue(int type, ConstantPool cpool)
{
@@ -47,8 +41,6 @@ public abstract class ElementValue
public abstract String stringifyValue();
- public abstract void dump(DataOutputStream dos) throws IOException;
-
public static final int STRING = 's';
public static final int ENUM_CONSTANT = 'e';
@@ -109,7 +101,8 @@ public abstract class ElementValue
return new SimpleElementValue(STRING, dis.readUnsignedShort(),
cpool);
case 'e': // Enum constant
- return new EnumElementValue(ENUM_CONSTANT, dis.readUnsignedShort(),
+ dis.readUnsignedShort(); // Unused type_index
+ return new EnumElementValue(ENUM_CONSTANT,
dis.readUnsignedShort(), cpool);
case 'c': // Class
return new ClassElementValue(CLASS, dis.readUnsignedShort(), cpool);
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.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;
/**
@@ -56,9 +53,4 @@ public class ElementValuePair
{
return elementValue;
}
-
- protected void dump(DataOutputStream dos) throws IOException {
- dos.writeShort(elementNameIndex); // u2 name of the element
- elementValue.dump(dos);
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/EnclosingMethod.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/EnclosingMethod.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/EnclosingMethod.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/EnclosingMethod.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;
-
/**
* This attribute exists for local or
* anonymous classes and ... there can be only one.
@@ -32,15 +30,10 @@ public class EnclosingMethod extends Att
// Ctors - and code to read an attribute in.
public EnclosingMethod(int nameIndex, int len, DataInputStream dis,
ConstantPool cpool) throws IOException {
- super(Constants.ATTR_ENCLOSING_METHOD, nameIndex, len, cpool);
+ super(nameIndex, len, cpool);
// Unused class index
dis.readUnsignedShort();
// Unused method index
dis.readUnsignedShort();
}
-
- @Override
- public Attribute copy(ConstantPool constant_pool) {
- throw new RuntimeException("Not implemented yet!");
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java Tue Oct 23 11:34:15 2012
@@ -17,38 +17,22 @@
*/
package org.apache.tomcat.util.bcel.classfile;
-import java.io.DataOutputStream;
-import java.io.IOException;
-
import org.apache.tomcat.util.bcel.Constants;
public class EnumElementValue extends ElementValue
{
- // For enum types, these two indices point to the type and value
- private int typeIdx;
-
private int valueIdx;
- public EnumElementValue(int type, int typeIdx, int valueIdx,
- ConstantPool cpool)
+ public EnumElementValue(int type, int valueIdx, ConstantPool cpool)
{
super(type, cpool);
if (type != ENUM_CONSTANT)
throw new RuntimeException(
"Only element values of type enum can be built with this ctor - type specified: " + type);
- this.typeIdx = typeIdx;
this.valueIdx = valueIdx;
}
@Override
- public void dump(DataOutputStream dos) throws IOException
- {
- dos.writeByte(type); // u1 type of value (ENUM_CONSTANT == 'e')
- dos.writeShort(typeIdx); // u2
- dos.writeShort(valueIdx); // u2
- }
-
- @Override
public String stringifyValue()
{
ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(valueIdx,
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/ExceptionTable.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 the table of exceptions that are thrown by a
* method. This attribute may be used once per method. The name of
@@ -49,7 +47,7 @@ public final class ExceptionTable extend
*/
public ExceptionTable(int name_index, int length, int[] exception_index_table,
ConstantPool constant_pool) {
- super(Constants.ATTR_EXCEPTIONS, name_index, length, constant_pool);
+ super(name_index, length, constant_pool);
setExceptionIndexTable(exception_index_table);
}
@@ -81,39 +79,4 @@ public final class ExceptionTable extend
this.exception_index_table = exception_index_table;
number_of_exceptions = (exception_index_table == null) ? 0 : exception_index_table.length;
}
-
-
- /**
- * @return String representation, i.e., a list of thrown exceptions.
- */
- @Override
- public final String toString() {
- StringBuilder buf = new StringBuilder();
- String str;
- for (int i = 0; i < number_of_exceptions; i++) {
- str = constant_pool.getConstantString(exception_index_table[i],
- Constants.CONSTANT_Class);
- buf.append(Utility.compactClassName(str, false));
- if (i < number_of_exceptions - 1) {
- buf.append(", ");
- }
- }
- return buf.toString();
- }
-
-
- /**
- * @return deep copy of this attribute
- */
- @Override
- public Attribute copy( ConstantPool _constant_pool ) {
- ExceptionTable c = (ExceptionTable) clone();
- if (exception_index_table != null) {
- c.exception_index_table = new int[exception_index_table.length];
- System.arraycopy(exception_index_table, 0, c.exception_index_table, 0,
- exception_index_table.length);
- }
- c.constant_pool = _constant_pool;
- return c;
- }
}
Modified: tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java
URL: http://svn.apache.org/viewvc/tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java?rev=1401253&r1=1401252&r2=1401253&view=diff
==============================================================================
--- tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java (original)
+++ tomcat/sandbox/trunk-resources/java/org/apache/tomcat/util/bcel/classfile/FieldOrMethod.java Tue Oct 23 11:34:15 2012
@@ -21,16 +21,35 @@ import java.io.DataInputStream;
import java.io.IOException;
import org.apache.tomcat.util.bcel.Constants;
+import org.apache.tomcat.util.bcel.util.BCELComparator;
/**
- * Abstract super class for fields and methods.
+ * Class for fields and methods.
*
* @version $Id$
* @author <A HREF="mailto:m.dahm@gmx.de">M. Dahm</A>
*/
-public abstract class FieldOrMethod extends AccessFlags implements Cloneable {
+public class FieldOrMethod extends AccessFlags implements Cloneable {
private static final long serialVersionUID = -3383525930205542157L;
+ private static BCELComparator _cmp = new BCELComparator() {
+
+ @Override
+ public boolean equals( Object o1, Object o2 ) {
+ FieldOrMethod THIS = (FieldOrMethod) o1;
+ FieldOrMethod THAT = (FieldOrMethod) o2;
+ return THIS.getName().equals(THAT.getName())
+ && THIS.getSignature().equals(THAT.getSignature());
+ }
+
+
+ @Override
+ public int hashCode( Object o ) {
+ FieldOrMethod THIS = (FieldOrMethod) o;
+ return THIS.getSignature().hashCode() ^ THIS.getName().hashCode();
+ }
+ };
+
protected int name_index; // Points to field name in constant pool
protected int signature_index; // Points to encoded signature
protected int attributes_count; // No. of attributes
@@ -104,4 +123,28 @@ public abstract class FieldOrMethod exte
c = (ConstantUtf8) constant_pool.getConstant(signature_index, Constants.CONSTANT_Utf8);
return c.getBytes();
}
+
+ /**
+ * Return value as defined by given BCELComparator strategy.
+ * By default two FieldOrMethod objects are said to be equal when
+ * their names and signatures are equal.
+ *
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals( Object obj ) {
+ return _cmp.equals(this, obj);
+ }
+
+
+ /**
+ * Return value as defined by given BCELComparator strategy.
+ * By default return the hashcode of the FieldOrMethod's name XOR signature.
+ *
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return _cmp.hashCode(this);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org