Author: kkolinko Date: Fri Sep 12 16:57:06 2014 New Revision: 1624592 URL: http://svn.apache.org/r1624592 Log: Add 'final' modifiers to fields. Remove several num_xxx fields that accompanied an xxx array.
Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java Fri Sep 12 16:57:06 2014 @@ -20,7 +20,7 @@ package org.apache.tomcat.util.bcel.clas public class AnnotationElementValue extends ElementValue { // For annotation element values, this is the annotation - private AnnotationEntry annotationEntry; + private final AnnotationEntry annotationEntry; AnnotationElementValue(int type, AnnotationEntry annotationEntry, ConstantPool cpool) Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java Fri Sep 12 16:57:06 2014 @@ -35,6 +35,7 @@ public class AnnotationEntry implements private final int type_index; private final ConstantPool constant_pool; + // FIXME: add 'final' private List<ElementValuePair> element_value_pairs; /** Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java Fri Sep 12 16:57:06 2014 @@ -20,7 +20,7 @@ package org.apache.tomcat.util.bcel.clas public class ArrayElementValue extends ElementValue { // For array types, this is the array - private ElementValue[] evalues; + private final ElementValue[] evalues; ArrayElementValue(int type, ElementValue[] datums, ConstantPool cpool) { Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java Fri Sep 12 16:57:06 2014 @@ -24,7 +24,7 @@ public class ClassElementValue extends E // For primitive types and string type, this points to the value entry in // the cpool // For 'class' this points to the class entry in the cpool - private int idx; + private final int idx; ClassElementValue(int type, int idx, ConstantPool cpool) { super(type, cpool); Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java Fri Sep 12 16:57:06 2014 @@ -42,8 +42,8 @@ public final class ClassParser { private static final int MAGIC = 0xCAFEBABE; - private DataInputStream file; - private String file_name; + private final DataInputStream file; + private final String file_name; private int class_name_index, superclass_name_index; private int access_flags; // Access rights of parsed class private int[] interfaces; // Names of implemented interfaces Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java Fri Sep 12 16:57:06 2014 @@ -39,7 +39,7 @@ public abstract class Constant { * need the tag as an index to select the corresponding class name from the * `CONSTANT_NAMES' array. */ - protected byte tag; + protected final byte tag; Constant(byte tag) { Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java Fri Sep 12 16:57:06 2014 @@ -32,7 +32,7 @@ import org.apache.tomcat.util.bcel.Const */ public final class ConstantClass extends Constant { - private int name_index; // Identical to ConstantString except for the name + private final int name_index; // Identical to ConstantString except for the name /** Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java Fri Sep 12 16:57:06 2014 @@ -32,7 +32,7 @@ import org.apache.tomcat.util.bcel.Const */ public final class ConstantDouble extends Constant { - private double bytes; + private final double bytes; /** Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java Fri Sep 12 16:57:06 2014 @@ -32,7 +32,7 @@ import org.apache.tomcat.util.bcel.Const */ public final class ConstantFloat extends Constant { - private float bytes; + private final float bytes; /** Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java Fri Sep 12 16:57:06 2014 @@ -32,7 +32,7 @@ import org.apache.tomcat.util.bcel.Const */ public final class ConstantInteger extends Constant { - private int bytes; + private final int bytes; /** Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java Fri Sep 12 16:57:06 2014 @@ -32,7 +32,7 @@ import org.apache.tomcat.util.bcel.Const */ public final class ConstantLong extends Constant { - private long bytes; + private final long bytes; /** Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java Fri Sep 12 16:57:06 2014 @@ -26,9 +26,9 @@ import java.io.IOException; */ public abstract class ElementValue { - protected int type; + protected final int type; - protected ConstantPool cpool; + protected final ConstantPool cpool; ElementValue(int type, ConstantPool cpool) { Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java Fri Sep 12 16:57:06 2014 @@ -27,11 +27,11 @@ import org.apache.tomcat.util.bcel.Const */ public class ElementValuePair { - private ElementValue elementValue; + private final ElementValue elementValue; - private ConstantPool constantPool; + private final ConstantPool constantPool; - private int elementNameIndex; + private final int elementNameIndex; ElementValuePair(int elementNameIndex, ElementValue elementValue, ConstantPool constantPool) { Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java Fri Sep 12 16:57:06 2014 @@ -21,7 +21,7 @@ import org.apache.tomcat.util.bcel.Const public class EnumElementValue extends ElementValue { - private int valueIdx; + private final int valueIdx; EnumElementValue(int type, int valueIdx, ConstantPool cpool) { super(type, cpool); Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java Fri Sep 12 16:57:06 2014 @@ -30,8 +30,7 @@ import org.apache.tomcat.util.bcel.Const */ public class ParameterAnnotationEntry implements Constants { - private int annotation_table_length; - private AnnotationEntry[] annotation_table; + private final AnnotationEntry[] annotation_table; /** @@ -40,7 +39,7 @@ public class ParameterAnnotationEntry im * @throws IOException */ ParameterAnnotationEntry(DataInputStream file, ConstantPool constant_pool) throws IOException { - annotation_table_length = (file.readUnsignedShort()); + int annotation_table_length = file.readUnsignedShort(); annotation_table = new AnnotationEntry[annotation_table_length]; for (int i = 0; i < annotation_table_length; i++) { annotation_table[i] = AnnotationEntry.read(file, constant_pool); 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=1624592&r1=1624591&r2=1624592&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 16:57:06 2014 @@ -28,8 +28,7 @@ import java.io.IOException; */ public abstract class ParameterAnnotations extends Attribute { - private int num_parameters; - private ParameterAnnotationEntry[] parameter_annotation_table; // Table of parameter annotations + private final ParameterAnnotationEntry[] parameter_annotation_table; // Table of parameter annotations /** @@ -38,22 +37,11 @@ public abstract class ParameterAnnotatio */ ParameterAnnotations(DataInputStream file, ConstantPool constant_pool) throws IOException { - num_parameters = (file.readUnsignedByte()); + int num_parameters = file.readUnsignedByte(); parameter_annotation_table = new ParameterAnnotationEntry[num_parameters]; for (int i = 0; i < num_parameters; i++) { parameter_annotation_table[i] = new ParameterAnnotationEntry(file, constant_pool); } } - - /** - * @param parameter_annotation_table the entries to set in this parameter annotation - */ - public final void setParameterAnnotationTable( - ParameterAnnotationEntry[] parameter_annotation_table ) { - this.parameter_annotation_table = parameter_annotation_table; - num_parameters = (parameter_annotation_table == null) - ? 0 - : parameter_annotation_table.length; - } } Modified: tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java?rev=1624592&r1=1624591&r2=1624592&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java (original) +++ tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java Fri Sep 12 16:57:06 2014 @@ -21,7 +21,7 @@ import org.apache.tomcat.util.bcel.Const public class SimpleElementValue extends ElementValue { - private int index; + private final int index; SimpleElementValue(int type, int index, ConstantPool cpool) { super(type, cpool); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org