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/13 01:53:25 UTC
svn commit: r1695627 -
/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/
Author: sebb
Date: Wed Aug 12 23:53:24 2015
New Revision: 1695627
URL: http://svn.apache.org/r1695627
Log:
BCEL-232 Make mutable fields private.
Modified:
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/AnnotationElementValueGen.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ArrayElementValueGen.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassElementValueGen.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ElementValueGen.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/EnumElementValueGen.java
commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/SimpleElementValueGen.java
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/AnnotationElementValueGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/AnnotationElementValueGen.java?rev=1695627&r1=1695626&r2=1695627&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/AnnotationElementValueGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/AnnotationElementValueGen.java Wed Aug 12 23:53:24 2015
@@ -58,7 +58,7 @@ public class AnnotationElementValueGen e
@Override
public void dump(DataOutputStream dos) throws IOException
{
- dos.writeByte(type); // u1 type of value (ANNOTATION == '@')
+ dos.writeByte(super.getElementValueType()); // u1 type of value (ANNOTATION == '@')
a.dump(dos);
}
@@ -74,7 +74,7 @@ public class AnnotationElementValueGen e
@Override
public ElementValue getElementValue()
{
- return new AnnotationElementValue(this.type, a.getAnnotation(), cpGen
+ return new AnnotationElementValue(super.getElementValueType(), a.getAnnotation(), getConstantPoolgen()
.getConstantPool());
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ArrayElementValueGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ArrayElementValueGen.java?rev=1695627&r1=1695626&r2=1695627&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ArrayElementValueGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ArrayElementValueGen.java Wed Aug 12 23:53:24 2015
@@ -65,7 +65,7 @@ public class ArrayElementValueGen extend
for (ElementValueGen element : evalues) {
immutableData[i++] = element.getElementValue();
}
- return new ArrayElementValue(type, immutableData, cpGen
+ return new ArrayElementValue(super.getElementValueType(), immutableData, getConstantPoolgen()
.getConstantPool());
}
@@ -87,7 +87,7 @@ public class ArrayElementValueGen extend
@Override
public void dump(DataOutputStream dos) throws IOException
{
- dos.writeByte(type); // u1 type of value (ARRAY == '[')
+ dos.writeByte(super.getElementValueType()); // u1 type of value (ARRAY == '[')
dos.writeShort(evalues.size());
for (ElementValueGen element : evalues) {
element.dump(dos);
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassElementValueGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassElementValueGen.java?rev=1695627&r1=1695626&r2=1695627&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassElementValueGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ClassElementValueGen.java Wed Aug 12 23:53:24 2015
@@ -56,7 +56,7 @@ public class ClassElementValueGen extend
@Override
public ElementValue getElementValue()
{
- return new ClassElementValue(type, idx, cpGen.getConstantPool());
+ return new ClassElementValue(super.getElementValueType(), idx, getConstantPoolgen().getConstantPool());
}
public ClassElementValueGen(ClassElementValue value, ConstantPoolGen cpool,
@@ -81,7 +81,7 @@ public class ClassElementValueGen extend
public String getClassString()
{
- ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(idx);
+ ConstantUtf8 cu8 = (ConstantUtf8) getConstantPoolgen().getConstant(idx);
return cu8.getBytes();
// ConstantClass c = (ConstantClass)getConstantPool().getConstant(idx);
// ConstantUtf8 utf8 =
@@ -98,7 +98,7 @@ public class ClassElementValueGen extend
@Override
public void dump(DataOutputStream dos) throws IOException
{
- dos.writeByte(type); // u1 kind of value
+ dos.writeByte(super.getElementValueType()); // u1 kind of value
dos.writeShort(idx);
}
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ElementValueGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ElementValueGen.java?rev=1695627&r1=1695626&r2=1695627&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ElementValueGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/ElementValueGen.java Wed Aug 12 23:53:24 2015
@@ -34,9 +34,9 @@ import org.apache.commons.bcel6.classfil
*/
public abstract class ElementValueGen
{
- protected int type;
+ private final int type;
- protected ConstantPoolGen cpGen;
+ private final ConstantPoolGen cpGen;
protected ElementValueGen(int type, ConstantPoolGen cpGen)
{
@@ -143,7 +143,7 @@ public abstract class ElementValueGen
}
}
- protected ConstantPoolGen getConstantPool()
+ protected ConstantPoolGen getConstantPoolgen()
{
return cpGen;
}
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/EnumElementValueGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/EnumElementValueGen.java?rev=1695627&r1=1695626&r2=1695627&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/EnumElementValueGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/EnumElementValueGen.java Wed Aug 12 23:53:24 2015
@@ -43,9 +43,9 @@ public class EnumElementValueGen extends
ConstantPoolGen cpool)
{
super(ElementValueGen.ENUM_CONSTANT, cpool);
- if (type != ENUM_CONSTANT) {
+ if (super.getElementValueType() != ENUM_CONSTANT) {
throw new RuntimeException(
- "Only element values of type enum can be built with this ctor - type specified: " + type);
+ "Only element values of type enum can be built with this ctor - type specified: " + super.getElementValueType());
}
this.typeIdx = typeIdx;
this.valueIdx = valueIdx;
@@ -59,7 +59,7 @@ public class EnumElementValueGen extends
{
System.err.println("Duplicating value: " + getEnumTypeString() + ":"
+ getEnumValueString());
- return new EnumElementValue(type, typeIdx, valueIdx, cpGen
+ return new EnumElementValue(super.getElementValueType(), typeIdx, valueIdx, getConstantPoolgen()
.getConstantPool());
}
@@ -91,7 +91,7 @@ public class EnumElementValueGen extends
@Override
public void dump(DataOutputStream dos) throws IOException
{
- dos.writeByte(type); // u1 type of value (ENUM_CONSTANT == 'e')
+ dos.writeByte(super.getElementValueType()); // u1 type of value (ENUM_CONSTANT == 'e')
dos.writeShort(typeIdx); // u2
dos.writeShort(valueIdx); // u2
}
@@ -99,7 +99,7 @@ public class EnumElementValueGen extends
@Override
public String stringifyValue()
{
- ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(
+ ConstantUtf8 cu8 = (ConstantUtf8) getConstantPoolgen().getConstant(
valueIdx);
return cu8.getBytes();
// ConstantString cu8 =
@@ -117,14 +117,14 @@ public class EnumElementValueGen extends
// (ConstantClass)getConstantPool().getConstant(typeIdx);
// return
// ((ConstantUtf8)getConstantPool().getConstant(cu8.getNameIndex())).getBytes();
- return ((ConstantUtf8) getConstantPool().getConstant(typeIdx))
+ return ((ConstantUtf8) getConstantPoolgen().getConstant(typeIdx))
.getBytes();
// return Utility.signatureToString(cu8.getBytes());
}
public String getEnumValueString()
{
- return ((ConstantUtf8) getConstantPool().getConstant(valueIdx))
+ return ((ConstantUtf8) getConstantPoolgen().getConstant(valueIdx))
.getBytes();
// ConstantString cu8 =
// (ConstantString)getConstantPool().getConstant(valueIdx);
Modified: commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/SimpleElementValueGen.java
URL: http://svn.apache.org/viewvc/commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/SimpleElementValueGen.java?rev=1695627&r1=1695626&r2=1695627&view=diff
==============================================================================
--- commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/SimpleElementValueGen.java (original)
+++ commons/proper/bcel/trunk/src/main/java/org/apache/commons/bcel6/generic/SimpleElementValueGen.java Wed Aug 12 23:53:24 2015
@@ -164,7 +164,7 @@ public class SimpleElementValueGen exten
default:
throw new RuntimeException(
"SimpleElementValueGen class does not know how "
- + "to copy this type " + type);
+ + "to copy this type " + super.getElementValueType());
}
}
}
@@ -175,7 +175,7 @@ public class SimpleElementValueGen exten
@Override
public ElementValue getElementValue()
{
- return new SimpleElementValue(type, idx, cpGen.getConstantPool());
+ return new SimpleElementValue(super.getElementValueType(), idx, getConstantPoolgen().getConstantPool());
}
public int getIndex()
@@ -185,21 +185,21 @@ public class SimpleElementValueGen exten
public String getValueString()
{
- if (type != STRING) {
+ if (super.getElementValueType() != STRING) {
throw new RuntimeException(
"Dont call getValueString() on a non STRING ElementValue");
}
- ConstantUtf8 c = (ConstantUtf8) cpGen.getConstant(idx);
+ ConstantUtf8 c = (ConstantUtf8) getConstantPoolgen().getConstant(idx);
return c.getBytes();
}
public int getValueInt()
{
- if (type != PRIMITIVE_INT) {
+ if (super.getElementValueType() != PRIMITIVE_INT) {
throw new RuntimeException(
"Dont call getValueString() on a non STRING ElementValue");
}
- ConstantInteger c = (ConstantInteger) cpGen.getConstant(idx);
+ ConstantInteger c = (ConstantInteger) getConstantPoolgen().getConstant(idx);
return c.getBytes();
}
@@ -207,51 +207,51 @@ public class SimpleElementValueGen exten
@Override
public String stringifyValue()
{
- switch (type)
+ switch (super.getElementValueType())
{
case PRIMITIVE_INT:
- ConstantInteger c = (ConstantInteger) cpGen.getConstant(idx);
+ ConstantInteger c = (ConstantInteger) getConstantPoolgen().getConstant(idx);
return Integer.toString(c.getBytes());
case PRIMITIVE_LONG:
- ConstantLong j = (ConstantLong) cpGen.getConstant(idx);
+ ConstantLong j = (ConstantLong) getConstantPoolgen().getConstant(idx);
return Long.toString(j.getBytes());
case PRIMITIVE_DOUBLE:
- ConstantDouble d = (ConstantDouble) cpGen.getConstant(idx);
+ ConstantDouble d = (ConstantDouble) getConstantPoolgen().getConstant(idx);
return Double.toString(d.getBytes());
case PRIMITIVE_FLOAT:
- ConstantFloat f = (ConstantFloat) cpGen.getConstant(idx);
+ ConstantFloat f = (ConstantFloat) getConstantPoolgen().getConstant(idx);
return Float.toString(f.getBytes());
case PRIMITIVE_SHORT:
- ConstantInteger s = (ConstantInteger) cpGen.getConstant(idx);
+ ConstantInteger s = (ConstantInteger) getConstantPoolgen().getConstant(idx);
return Integer.toString(s.getBytes());
case PRIMITIVE_BYTE:
- ConstantInteger b = (ConstantInteger) cpGen.getConstant(idx);
+ ConstantInteger b = (ConstantInteger) getConstantPoolgen().getConstant(idx);
return Integer.toString(b.getBytes());
case PRIMITIVE_CHAR:
- ConstantInteger ch = (ConstantInteger) cpGen.getConstant(idx);
+ ConstantInteger ch = (ConstantInteger) getConstantPoolgen().getConstant(idx);
return Integer.toString(ch.getBytes());
case PRIMITIVE_BOOLEAN:
- ConstantInteger bo = (ConstantInteger) cpGen.getConstant(idx);
+ ConstantInteger bo = (ConstantInteger) getConstantPoolgen().getConstant(idx);
if (bo.getBytes() == 0) {
return "false";
} else {
return "true";
}
case STRING:
- ConstantUtf8 cu8 = (ConstantUtf8) cpGen.getConstant(idx);
+ ConstantUtf8 cu8 = (ConstantUtf8) getConstantPoolgen().getConstant(idx);
return cu8.getBytes();
default:
throw new RuntimeException(
"SimpleElementValueGen class does not know how to stringify type "
- + type);
+ + super.getElementValueType());
}
}
@Override
public void dump(DataOutputStream dos) throws IOException
{
- dos.writeByte(type); // u1 kind of value
- switch (type)
+ dos.writeByte(super.getElementValueType()); // u1 kind of value
+ switch (super.getElementValueType())
{
case PRIMITIVE_INT:
case PRIMITIVE_BYTE:
@@ -267,7 +267,7 @@ public class SimpleElementValueGen exten
default:
throw new RuntimeException(
"SimpleElementValueGen doesnt know how to write out type "
- + type);
+ + super.getElementValueType());
}
}
}