Author: markt
Date: Wed Sep 17 12:03:10 2014
New Revision: 1625536
URL: http://svn.apache.org/r1625536
Log:
Add 'final' modifiers to fields.
Remove several num_xxx fields that accompanied an xxx array.
Port of r1624592 from trunk
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
Merged /tomcat/trunk:r1624592
Propchange: tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/
------------------------------------------------------------------------------
Merged /tomcat/trunk/java/org/apache/tomcat/util/bcel:r1624592
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationElementValue.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/AnnotationEntry.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ArrayElementValue.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassElementValue.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ClassParser.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantClass.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantDouble.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantFloat.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantInteger.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ConstantLong.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValue.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ElementValuePair.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/EnumElementValue.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotationEntry.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/ParameterAnnotations.java
Wed Sep 17 12:03:10 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/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java?rev=1625536&r1=1625535&r2=1625536&view=diff
==============================================================================
---
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java
(original)
+++
tomcat/tc7.0.x/trunk/java/org/apache/tomcat/util/bcel/classfile/SimpleElementValue.java
Wed Sep 17 12:03:10 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: [email protected]
For additional commands, e-mail: [email protected]