commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1697697 - in /commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile: AnnotationElementValue.java ArrayElementValue.java ClassElementValue.java EnumElementValue.java SimpleElementValue.java
Date Tue, 25 Aug 2015 15:21:09 GMT
Author: sebb
Date: Tue Aug 25 15:21:08 2015
New Revision: 1697697

URL: http://svn.apache.org/r1697697
Log:
Replace direct use of external fields with getter/setter

Modified:
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/AnnotationElementValue.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ArrayElementValue.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ClassElementValue.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/EnumElementValue.java
    commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/SimpleElementValue.java

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/AnnotationElementValue.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/AnnotationElementValue.java?rev=1697697&r1=1697696&r2=1697697&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/AnnotationElementValue.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/AnnotationElementValue.java
Tue Aug 25 15:21:08 2015
@@ -42,7 +42,7 @@ public class AnnotationElementValue exte
         @Override
         public void dump(DataOutputStream dos) throws IOException
         {
-                dos.writeByte(type); // u1 type of value (ANNOTATION == '@')
+                dos.writeByte(super.getType()); // u1 type of value (ANNOTATION == '@')
                 annotationEntry.dump(dos);
         }
 

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ArrayElementValue.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ArrayElementValue.java?rev=1697697&r1=1697696&r2=1697697&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ArrayElementValue.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ArrayElementValue.java
Tue Aug 25 15:21:08 2015
@@ -57,7 +57,7 @@ public class ArrayElementValue extends E
     @Override
     public void dump(DataOutputStream dos) throws IOException
     {
-        dos.writeByte(type); // u1 type of value (ARRAY == '[')
+        dos.writeByte(super.getType()); // u1 type of value (ARRAY == '[')
         dos.writeShort(evalues.length);
         for (ElementValue evalue : evalues) {
             evalue.dump(dos);

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ClassElementValue.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ClassElementValue.java?rev=1697697&r1=1697696&r2=1697697&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ClassElementValue.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/ClassElementValue.java
Tue Aug 25 15:21:08 2015
@@ -45,7 +45,7 @@ public class ClassElementValue extends E
 
     public String getClassString()
     {
-        ConstantUtf8 c = (ConstantUtf8) cpool.getConstant(idx,
+        ConstantUtf8 c = (ConstantUtf8) super.getConstantPool().getConstant(idx,
                 Constants.CONSTANT_Utf8);
         return c.getBytes();
     }
@@ -53,7 +53,7 @@ public class ClassElementValue extends E
     @Override
     public String stringifyValue()
     {
-        ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(idx,
+        ConstantUtf8 cu8 = (ConstantUtf8) super.getConstantPool().getConstant(idx,
                 Constants.CONSTANT_Utf8);
         return cu8.getBytes();
     }
@@ -61,7 +61,7 @@ public class ClassElementValue extends E
     @Override
     public void dump(DataOutputStream dos) throws IOException
     {
-        dos.writeByte(type); // u1 kind of value
+        dos.writeByte(super.getType()); // u1 kind of value
         dos.writeShort(idx);
     }
 }

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/EnumElementValue.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/EnumElementValue.java?rev=1697697&r1=1697696&r2=1697697&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/EnumElementValue.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/EnumElementValue.java
Tue Aug 25 15:21:08 2015
@@ -47,7 +47,7 @@ public class EnumElementValue extends El
     @Override
     public void dump(DataOutputStream dos) throws IOException
     {
-        dos.writeByte(type); // u1 type of value (ENUM_CONSTANT == 'e')
+        dos.writeByte(super.getType()); // u1 type of value (ENUM_CONSTANT == 'e')
         dos.writeShort(typeIdx); // u2
         dos.writeShort(valueIdx); // u2
     }
@@ -55,21 +55,21 @@ public class EnumElementValue extends El
     @Override
     public String stringifyValue()
     {
-        ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(valueIdx,
+        ConstantUtf8 cu8 = (ConstantUtf8) super.getConstantPool().getConstant(valueIdx,
                 Constants.CONSTANT_Utf8);
         return cu8.getBytes();
     }
 
     public String getEnumTypeString()
     {
-        ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(typeIdx,
+        ConstantUtf8 cu8 = (ConstantUtf8) super.getConstantPool().getConstant(typeIdx,
                 Constants.CONSTANT_Utf8);
         return cu8.getBytes();// Utility.signatureToString(cu8.getBytes());
     }
 
     public String getEnumValueString()
     {
-        ConstantUtf8 cu8 = (ConstantUtf8) cpool.getConstant(valueIdx,
+        ConstantUtf8 cu8 = (ConstantUtf8) super.getConstantPool().getConstant(valueIdx,
                 Constants.CONSTANT_Utf8);
         return cu8.getBytes();
     }

Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/SimpleElementValue.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/SimpleElementValue.java?rev=1697697&r1=1697696&r2=1697697&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/SimpleElementValue.java
(original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/classfile/SimpleElementValue.java
Tue Aug 25 15:21:08 2015
@@ -50,95 +50,95 @@ public class SimpleElementValue extends
 
     public String getValueString()
     {
-        if (type != STRING) {
+        if (super.getType() != STRING) {
             throw new RuntimeException(
                     "Dont call getValueString() on a non STRING ElementValue");
         }
-        ConstantUtf8 c = (ConstantUtf8) cpool.getConstant(getIndex(),
+        ConstantUtf8 c = (ConstantUtf8) super.getConstantPool().getConstant(getIndex(),
                 Constants.CONSTANT_Utf8);
         return c.getBytes();
     }
 
     public int getValueInt()
     {
-        if (type != PRIMITIVE_INT) {
+        if (super.getType() != PRIMITIVE_INT) {
             throw new RuntimeException(
                     "Dont call getValueString() on a non STRING ElementValue");
         }
-        ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(),
+        ConstantInteger c = (ConstantInteger) super.getConstantPool().getConstant(getIndex(),
                 Constants.CONSTANT_Integer);
         return c.getBytes();
     }
 
     public byte getValueByte()
     {
-        if (type != PRIMITIVE_BYTE) {
+        if (super.getType() != PRIMITIVE_BYTE) {
             throw new RuntimeException(
                     "Dont call getValueByte() on a non BYTE ElementValue");
         }
-        ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(),
+        ConstantInteger c = (ConstantInteger) super.getConstantPool().getConstant(getIndex(),
                 Constants.CONSTANT_Integer);
         return (byte) c.getBytes();
     }
 
     public char getValueChar()
     {
-        if (type != PRIMITIVE_CHAR) {
+        if (super.getType() != PRIMITIVE_CHAR) {
             throw new RuntimeException(
                     "Dont call getValueChar() on a non CHAR ElementValue");
         }
-        ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(),
+        ConstantInteger c = (ConstantInteger) super.getConstantPool().getConstant(getIndex(),
                 Constants.CONSTANT_Integer);
         return (char) c.getBytes();
     }
 
     public long getValueLong()
     {
-        if (type != PRIMITIVE_LONG) {
+        if (super.getType() != PRIMITIVE_LONG) {
             throw new RuntimeException(
                     "Dont call getValueLong() on a non LONG ElementValue");
         }
-        ConstantLong j = (ConstantLong) cpool.getConstant(getIndex());
+        ConstantLong j = (ConstantLong) super.getConstantPool().getConstant(getIndex());
         return j.getBytes();
     }
 
     public float getValueFloat()
     {
-        if (type != PRIMITIVE_FLOAT) {
+        if (super.getType() != PRIMITIVE_FLOAT) {
             throw new RuntimeException(
                     "Dont call getValueFloat() on a non FLOAT ElementValue");
         }
-        ConstantFloat f = (ConstantFloat) cpool.getConstant(getIndex());
+        ConstantFloat f = (ConstantFloat) super.getConstantPool().getConstant(getIndex());
         return f.getBytes();
     }
 
     public double getValueDouble()
     {
-        if (type != PRIMITIVE_DOUBLE) {
+        if (super.getType() != PRIMITIVE_DOUBLE) {
             throw new RuntimeException(
                     "Dont call getValueDouble() on a non DOUBLE ElementValue");
         }
-        ConstantDouble d = (ConstantDouble) cpool.getConstant(getIndex());
+        ConstantDouble d = (ConstantDouble) super.getConstantPool().getConstant(getIndex());
         return d.getBytes();
     }
 
     public boolean getValueBoolean()
     {
-        if (type != PRIMITIVE_BOOLEAN) {
+        if (super.getType() != PRIMITIVE_BOOLEAN) {
             throw new RuntimeException(
                     "Dont call getValueBoolean() on a non BOOLEAN ElementValue");
         }
-        ConstantInteger bo = (ConstantInteger) cpool.getConstant(getIndex());
+        ConstantInteger bo = (ConstantInteger) super.getConstantPool().getConstant(getIndex());
         return bo.getBytes() != 0;
     }
 
     public short getValueShort()
     {
-        if (type != PRIMITIVE_SHORT) {
+        if (super.getType() != PRIMITIVE_SHORT) {
             throw new RuntimeException(
                     "Dont call getValueShort() on a non SHORT ElementValue");
         }
-        ConstantInteger s = (ConstantInteger) cpool.getConstant(getIndex());
+        ConstantInteger s = (ConstantInteger) super.getConstantPool().getConstant(getIndex());
         return (short) s.getBytes();
     }
 
@@ -152,7 +152,9 @@ public class SimpleElementValue extends
     @Override
     public String stringifyValue()
     {
-        switch (type)
+        ConstantPool cpool = super.getConstantPool();
+        final int _type = super.getType();
+        switch (_type)
         {
         case PRIMITIVE_INT:
             ConstantInteger c = (ConstantInteger) cpool.getConstant(getIndex(),
@@ -196,15 +198,16 @@ public class SimpleElementValue extends
         default:
             throw new RuntimeException(
                     "SimpleElementValue class does not know how to stringify type "
-                            + type);
+                            + _type);
         }
     }
 
     @Override
     public void dump(DataOutputStream dos) throws IOException
     {
-        dos.writeByte(type); // u1 kind of value
-        switch (type)
+        final int _type = super.getType();
+        dos.writeByte(_type); // u1 kind of value
+        switch (_type)
         {
         case PRIMITIVE_INT:
         case PRIMITIVE_BYTE:
@@ -220,7 +223,7 @@ public class SimpleElementValue extends
         default:
             throw new RuntimeException(
                     "SimpleElementValue doesnt know how to write out type "
-                            + type);
+                            + _type);
         }
     }
 }



Mime
View raw message