Author: markt Date: Sun Oct 14 14:26:18 2012 New Revision: 1398089 URL: http://svn.apache.org/viewvc?rev=1398089&view=rev Log: Start to strip out the unused classes
Removed: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/CodeException.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClass.java Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java?rev=1398089&r1=1398088&r2=1398089&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Code.java Sun Oct 14 14:26:18 2012 @@ -35,7 +35,6 @@ import java.io.IOException; * @version $Id$ * @author <A HREF="mailto:m.d...@gmx.de">M. Dahm</A> * @see Attribute - * @see CodeException * @see LineNumberTable * @see LocalVariableTable */ @@ -45,7 +44,6 @@ public final class Code extends Attribut 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 @@ -59,8 +57,8 @@ 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, (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(); @@ -70,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' @@ -94,15 +91,13 @@ public final class Code extends Attribut * @param name_index Index pointing to the name <em>Code</em> * @param length Content length in bytes * @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, byte[] code, - CodeException[] exception_table, Attribute[] attributes, ConstantPool constant_pool) { + Attribute[] attributes, ConstantPool constant_pool) { super(name_index, length, constant_pool); setCode(code); - setExceptionTable(exception_table); setAttributes(attributes); // Overwrites length! } @@ -151,14 +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 - } } Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java?rev=1398089&r1=1398088&r2=1398089&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/InnerClasses.java Sun Oct 14 14:26:18 2012 @@ -33,24 +33,10 @@ import java.io.IOException; 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(name_index, length, constant_pool); - setInnerClasses(inner_classes); - } - - - /** * Construct object from file stream. * * @param name_index Index in constant pool to CONSTANT_Utf8 @@ -61,20 +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); + Utility.swallowInnerClass(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; - } } Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java?rev=1398089&r1=1398088&r2=1398089&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Utility.java Sun Oct 14 14:26:18 2012 @@ -17,6 +17,9 @@ */ package org.apache.tomcat.util.bcel.classfile; +import java.io.DataInput; +import java.io.IOException; + /** * Utility functions that do not really belong to any class in particular. @@ -87,4 +90,20 @@ public abstract class Utility { CHAR_MAP[j] = '_'; MAP_CHAR['_'] = j; } + + protected static void swallowCodeException(DataInput file) + throws IOException { + file.readUnsignedShort(); // Unused start_pc + file.readUnsignedShort(); // Unused end_pc + file.readUnsignedShort(); // Unused handler_pc + file.readUnsignedShort(); // Unused catch_type + } + + protected static void swallowInnerClass(DataInput file) + throws IOException { + file.readUnsignedShort(); // Unused inner_class_index + file.readUnsignedShort(); // Unused outer_class_index + file.readUnsignedShort(); // Unused inner_name_index + file.readUnsignedShort(); // Unused inner_access_flags + } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org