commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1695518 - in /commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile: Attribute.java Constant.java ConstantCP.java ElementValue.java FieldOrMethod.java
Date Wed, 12 Aug 2015 13:58:52 GMT
Author: sebb
Date: Wed Aug 12 13:58:52 2015
New Revision: 1695518

URL: http://svn.apache.org/r1695518
Log:
BCEL-232 Make mutable fields private.

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantCP.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ElementValue.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/FieldOrMethod.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java?rev=1695518&r1=1695517&r2=1695518&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Attribute.java
Wed Aug 12 13:58:52 2015
@@ -52,13 +52,13 @@ public abstract class Attribute implemen
 {
     private static final long serialVersionUID = -1707826820310002955L;
 
-    protected int name_index; // Points to attribute name in constant pool TODO make private
(has getter & setter)
+    private int name_index; // Points to attribute name in constant pool
 
-    protected int length; // Content length of attribute field TODO make private (has getter
& setter)
+    private int length; // Content length of attribute field
 
-    protected byte tag; // Tag to distinguish subclasses TODO make private & final; supposed
to be immutable
+    private final byte tag; // Tag to distinguish subclasses
 
-    protected ConstantPool constant_pool; // TODO make private (has getter & setter)
+    private ConstantPool constant_pool;
 
     protected Attribute(byte tag, int name_index, int length, ConstantPool constant_pool)
     {
@@ -260,7 +260,7 @@ public abstract class Attribute implemen
     /**
      * @param name_index of attribute.
      */
-    public final void setNameIndex(int name_index)
+    public final void setNameIndex(int name_index) // TODO unused
     {
         this.name_index = name_index;
     }

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java?rev=1695518&r1=1695517&r2=1695518&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Constant.java
Wed Aug 12 13:58:52 2015
@@ -57,7 +57,7 @@ public abstract class Constant implement
      * need the tag as an index to select the corresponding class name from the 
      * `CONSTANT_NAMES' array.
      */
-    protected byte tag; // TODO should be private & final
+    private final byte tag;
 
 
     Constant(byte tag) {

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantCP.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantCP.java?rev=1695518&r1=1695517&r2=1695518&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantCP.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ConstantCP.java
Wed Aug 12 13:58:52 2015
@@ -40,9 +40,9 @@ public abstract class ConstantCP extends
      */
     // Note that this field is used to store the
     // bootstrap_method_attr_index of a ConstantInvokeDynamic.
-    protected int class_index; // TODO make private (has getter & setter) could be final
(setter unused)
+    private final int class_index;
     // This field has the same meaning for all subclasses.
-    protected int name_and_type_index; // TODO make private (has getter & setter) could
be final (setter unused)
+    private final int name_and_type_index;
 
 
     /**
@@ -110,25 +110,6 @@ public abstract class ConstantCP extends
 
 
     /**
-     * @param class_index points to Constant_class 
-     */
-    public final void setClassIndex( int class_index ) { // TODO unused
-        this.class_index = class_index;
-    }
-
-
-    /**
-     * @param bootstrap_method_attr_index points to a BootstrapMethod. 
-     *
-     * Note that this method is a functional duplicate of setClassIndex
-     * for use by ConstantInvokeDynamic.
-     */
-    public final void setBootstrapMethodAttrIndex(int bootstrap_method_attr_index) { // TODO
unused
-        this.class_index = bootstrap_method_attr_index;
-    }
-
-
-    /**
      * @return Reference (index) to signature of the field.
      */
     public final int getNameAndTypeIndex() {
@@ -136,14 +117,6 @@ public abstract class ConstantCP extends
     }
 
 
-    /**
-     * @param name_and_type_index points to Constant_NameAndType
-     */
-    public final void setNameAndTypeIndex( int name_and_type_index ) {
-        this.name_and_type_index = name_and_type_index;
-    }
-
-
     /**
      * @return Class this field belongs to.
      */

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ElementValue.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ElementValue.java?rev=1695518&r1=1695517&r2=1695518&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ElementValue.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ElementValue.java
Wed Aug 12 13:58:52 2015
@@ -27,9 +27,9 @@ import java.io.IOException;
  */
 public abstract class ElementValue
 {
-    protected int type; // TODO should be final
+    protected final int type;
 
-    protected ConstantPool cpool; // TODO should be final
+    protected final ConstantPool cpool;
 
     @Override
     public String toString()

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/FieldOrMethod.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/FieldOrMethod.java?rev=1695518&r1=1695517&r2=1695518&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/FieldOrMethod.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/FieldOrMethod.java
Wed Aug 12 13:58:52 2015
@@ -31,12 +31,12 @@ import org.apache.commons.bcel6.Constant
 public abstract class FieldOrMethod extends AccessFlags implements Cloneable, Node {
 
     private static final long serialVersionUID = -1833306330869469714L;
-    // TODO should be made private
-    protected int name_index; // Points to field name in constant pool 
-    protected int signature_index; // Points to encoded signature
-    protected Attribute[] attributes; // Collection of attributes
-    protected AnnotationEntry[] annotationEntries; // annotations defined on the field or
method 
-    protected ConstantPool constant_pool;
+
+    private int name_index; // Points to field name in constant pool 
+    private int signature_index; // Points to encoded signature
+    private Attribute[] attributes; // Collection of attributes
+    private AnnotationEntry[] annotationEntries; // annotations defined on the field or method

+    private ConstantPool constant_pool;
 
     private String signatureAttributeString = null;
     private boolean searchedForSignatureAttribute = false;



Mime
View raw message