Author: kkolinko Date: Fri Sep 12 15:02:00 2014 New Revision: 1624564 URL: http://svn.apache.org/r1624564 Log: Remove unused method Attribute.getName(). It allows to remove name_index field as well. Found thanks to Cobertura coverage report.
Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java?rev=1624564&r1=1624563&r2=1624564&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationDefault.java Fri Sep 12 15:02:00 2014 @@ -29,8 +29,6 @@ import java.io.IOException; public class AnnotationDefault extends Attribute { /** - * @param name_index - * Index pointing to the name <em>Code</em> * @param length * Content length in bytes * @param file @@ -38,11 +36,9 @@ public class AnnotationDefault extends A * @param constant_pool * Array of constants */ - public AnnotationDefault(int name_index, int length, - DataInputStream file, ConstantPool constant_pool) - throws IOException - { - super(name_index, length, constant_pool); + public AnnotationDefault(int length, DataInputStream file, + ConstantPool constant_pool) throws IOException { + super(length, constant_pool); // Default value ElementValue.readElementValue(file, constant_pool); } Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java?rev=1624564&r1=1624563&r2=1624564&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Annotations.java Fri Sep 12 15:02:00 2014 @@ -31,14 +31,13 @@ public abstract class Annotations extend private final AnnotationEntry[] annotation_table; /** - * @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(int name_index, int length, DataInputStream file, + public Annotations(int length, DataInputStream file, ConstantPool constant_pool) throws IOException { - super(name_index, length, constant_pool); + super(length, 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++) { Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java?rev=1624564&r1=1624563&r2=1624564&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Attribute.java Fri Sep 12 15:02:00 2014 @@ -34,16 +34,11 @@ import org.apache.tomcat.util.bcel.Const */ public abstract class Attribute { - protected int name_index; // Points to attribute name in constant pool - protected int length; // Content length of attribute field protected ConstantPool constant_pool; - protected Attribute(int name_index, int length, - ConstantPool constant_pool) - { - this.name_index = name_index; + protected Attribute(int length, ConstantPool constant_pool) { this.length = length; this.constant_pool = constant_pool; } @@ -88,27 +83,15 @@ public abstract class Attribute { switch (tag) { case Constants.ATTR_RUNTIME_VISIBLE_ANNOTATIONS: - return new RuntimeVisibleAnnotations(name_index, length, file, - constant_pool); + return new RuntimeVisibleAnnotations(length, file, constant_pool); case Constants.ATTR_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS: - return new RuntimeVisibleParameterAnnotations(name_index, length, - file, constant_pool); - case Constants.ATTR_ANNOTATION_DEFAULT: - return new AnnotationDefault(name_index, length, file, + return new RuntimeVisibleParameterAnnotations(length, file, constant_pool); + case Constants.ATTR_ANNOTATION_DEFAULT: + return new AnnotationDefault(length, file, constant_pool); default: // All other attributes are skipped Utility.skipFully(file, length); return null; } } - - /** - * @return Name of attribute - */ - public String getName() - { - ConstantUtf8 c = (ConstantUtf8) constant_pool.getConstant(name_index, - Constants.CONSTANT_Utf8); - return c.getBytes(); - } } Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java?rev=1624564&r1=1624563&r2=1624564&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java Fri Sep 12 15:02:00 2014 @@ -33,14 +33,13 @@ public abstract class ParameterAnnotatio /** - * @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(int name_index, int length, - DataInputStream file, ConstantPool constant_pool) throws IOException { - super(name_index, length, constant_pool); + ParameterAnnotations(int length, DataInputStream file, + ConstantPool constant_pool) throws IOException { + super(length, constant_pool); num_parameters = (file.readUnsignedByte()); parameter_annotation_table = new ParameterAnnotationEntry[num_parameters]; for (int i = 0; i < num_parameters; i++) { Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java?rev=1624564&r1=1624563&r2=1624564&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleAnnotations.java Fri Sep 12 15:02:00 2014 @@ -30,8 +30,6 @@ import java.io.IOException; public class RuntimeVisibleAnnotations extends Annotations { /** - * @param name_index - * Index pointing to the name <em>Code</em> * @param length * Content length in bytes * @param file @@ -39,10 +37,8 @@ public class RuntimeVisibleAnnotations e * @param constant_pool * Array of constants */ - public RuntimeVisibleAnnotations(int name_index, int length, - DataInputStream file, ConstantPool constant_pool) - throws IOException - { - super(name_index, length, file, constant_pool); + public RuntimeVisibleAnnotations(int length, DataInputStream file, + ConstantPool constant_pool) throws IOException { + super(length, file, constant_pool); } } Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java?rev=1624564&r1=1624563&r2=1624564&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/RuntimeVisibleParameterAnnotations.java Fri Sep 12 15:02:00 2014 @@ -30,13 +30,12 @@ import java.io.IOException; public class RuntimeVisibleParameterAnnotations extends ParameterAnnotations { /** - * @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 */ - RuntimeVisibleParameterAnnotations(int name_index, int length, DataInputStream file, + RuntimeVisibleParameterAnnotations(int length, DataInputStream file, ConstantPool constant_pool) throws IOException { - super(name_index, length, file, constant_pool); + super(length, file, constant_pool); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org