You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2015/08/10 18:35:33 UTC

svn commit: r1695130 - in /commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile: Field.java Method.java

Author: sebb
Date: Mon Aug 10 16:35:33 2015
New Revision: 1695130

URL: http://svn.apache.org/r1695130
Log:
Use getter

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Field.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Method.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Field.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Field.java?rev=1695130&r1=1695129&r2=1695130&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Field.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Field.java Mon Aug 10 16:35:33 2015
@@ -34,7 +34,7 @@ import org.apache.commons.bcel6.util.BCE
 public final class Field extends FieldOrMethod {
 
     private static final long serialVersionUID = -4604082205545049134L;
-    private static BCELComparator _cmp = new BCELComparator() {
+    private static BCELComparator _cmp = new BCELComparator() { // TODO could be final (setter unused)
 
         public boolean equals( Object o1, Object o2 ) {
             Field THIS = (Field) o1;
@@ -99,7 +99,7 @@ public final class Field extends FieldOr
      * @return constant value associated with this field (may be null)
      */
     public final ConstantValue getConstantValue() {
-        for (Attribute attribute : attributes) {
+        for (Attribute attribute : super.getAttributes()) {
             if (attribute.getTag() == Constants.ATTR_CONSTANT_VALUE) {
                 return (ConstantValue) attribute;
             }
@@ -128,7 +128,7 @@ public final class Field extends FieldOr
         if (cv != null) {
             buf.append(" = ").append(cv);
         }
-        for (Attribute attribute : attributes) {
+        for (Attribute attribute : super.getAttributes()) {
             if (!(attribute instanceof ConstantValue)) {
                 buf.append(" [").append(attribute.toString()).append("]");
             }
@@ -164,7 +164,7 @@ public final class Field extends FieldOr
     /**
      * @param comparator Comparison strategy object
      */
-    public static void setComparator( BCELComparator comparator ) {
+    public static void setComparator( BCELComparator comparator ) { // TODO unused
         _cmp = comparator;
     }
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Method.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Method.java?rev=1695130&r1=1695129&r2=1695130&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Method.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/Method.java Mon Aug 10 16:35:33 2015
@@ -112,7 +112,7 @@ public final class Method extends FieldO
      * @return Code attribute of method, if any
      */
     public final Code getCode() {
-        for (Attribute attribute : attributes) {
+        for (Attribute attribute : super.getAttributes()) {
             if (attribute instanceof Code) {
                 return (Code) attribute;
             }
@@ -126,7 +126,7 @@ public final class Method extends FieldO
      * exceptions the method may throw not exception handlers!
      */
     public final ExceptionTable getExceptionTable() {
-        for (Attribute attribute : attributes) {
+        for (Attribute attribute : super.getAttributes()) {
             if (attribute instanceof ExceptionTable) {
                 return (ExceptionTable) attribute;
             }
@@ -172,14 +172,14 @@ public final class Method extends FieldO
         StringBuilder buf;
         access = Utility.accessToString(super.getAccessFlags());
         // Get name and signature from constant pool
-        c = (ConstantUtf8) constant_pool.getConstant(signature_index, Constants.CONSTANT_Utf8);
+        c = (ConstantUtf8) super.getConstantPool().getConstant(super.getSignatureIndex(), Constants.CONSTANT_Utf8);
         signature = c.getBytes();
-        c = (ConstantUtf8) constant_pool.getConstant(name_index, Constants.CONSTANT_Utf8);
+        c = (ConstantUtf8) super.getConstantPool().getConstant(super.getNameIndex(), Constants.CONSTANT_Utf8);
         name = c.getBytes();
         signature = Utility.methodSignatureToString(signature, name, access, true,
                 getLocalVariableTable());
         buf = new StringBuilder(signature);
-        for (Attribute attribute : attributes) {
+        for (Attribute attribute : super.getAttributes()) {
             if (!((attribute instanceof Code) || (attribute instanceof ExceptionTable))) {
                 buf.append(" [").append(attribute.toString()).append("]");
             }