/**
* Abstract super class for Fieldref and Methodref constants.
*
- * @version $Id: ConstantCP.java,v 1.4 2009/09/10 15:35:05 aclement Exp $
+ * @version $Id: ConstantCP.java,v 1.5 2009/09/16 00:43:49 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see ConstantFieldref
* @see ConstantMethodref
protected int classIndex, nameAndTypeIndex;
- public ConstantCP(ConstantCP c) {
- this(c.getTag(), c.getClassIndex(), c.getNameAndTypeIndex());
- }
-
ConstantCP(byte tag, DataInputStream file) throws IOException {
this(tag, file.readUnsignedShort(), file.readUnsignedShort());
}
* This class is derived from the abstract <A HREF="org.aspectj.apache.bcel.classfile.Constant.html">Constant</A> class and
* represents a reference to a (external) class.
*
- * @version $Id: ConstantClass.java,v 1.5 2009/09/10 15:35:05 aclement Exp $
+ * @version $Id: ConstantClass.java,v 1.6 2009/09/16 00:43:49 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @author Andy Clement
*/
public final class ConstantClass extends Constant {
private int nameIndex;
- public ConstantClass(ConstantClass c) {
- this(c.getNameIndex());
- }
-
ConstantClass(DataInputStream file) throws IOException {
super(Constants.CONSTANT_Class);
this.nameIndex = file.readUnsignedShort();
* This class is derived from the abstract <A HREF="org.aspectj.apache.bcel.classfile.Constant.html">Constant</A> class and
* represents a reference to a Double object.
*
- * @version $Id: ConstantDouble.java,v 1.5 2009/09/10 15:35:04 aclement Exp $
+ * @version $Id: ConstantDouble.java,v 1.6 2009/09/16 00:43:49 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @author Andy Clement
*/
this.value = value;
}
- public ConstantDouble(ConstantDouble c) {
- this(c.getValue());
- }
-
ConstantDouble(DataInputStream file) throws IOException {
this(file.readDouble());
}
/**
* This class represents a constant pool reference to a field.
*
- * @version $Id: ConstantFieldref.java,v 1.4 2009/09/10 15:35:04 aclement Exp $
+ * @version $Id: ConstantFieldref.java,v 1.5 2009/09/16 00:43:49 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
public final class ConstantFieldref extends ConstantCP {
- public ConstantFieldref(ConstantFieldref c) {
- super(Constants.CONSTANT_Fieldref, c.getClassIndex(), c.getNameAndTypeIndex());
- }
-
ConstantFieldref(DataInputStream file) throws IOException {
super(Constants.CONSTANT_Fieldref, file);
}
* This class is derived from the abstract <A HREF="org.aspectj.apache.bcel.classfile.Constant.html">Constant</A> class and
* represents a reference to a float object.
*
- * @version $Id: ConstantFloat.java,v 1.4 2009/09/10 15:35:05 aclement Exp $
+ * @version $Id: ConstantFloat.java,v 1.5 2009/09/16 00:43:49 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Constant
*/
this.floatValue = floatValue;
}
- public ConstantFloat(ConstantFloat c) {
- this(c.getValue());
- }
-
ConstantFloat(DataInputStream file) throws IOException {
this(file.readFloat());
}
return Float.toString(floatValue);
}
- public final float getFloatValue() {
- return floatValue;
- }
-
- public final void setBytes(float bytes) {
- this.floatValue = bytes;
- }
-
@Override
public final String toString() {
return super.toString() + "(bytes = " + floatValue + ")";
* This class is derived from the abstract <A HREF="org.aspectj.apache.bcel.classfile.Constant.html">Constant</A> class and
* represents a reference to an int object.
*
- * @version $Id: ConstantInteger.java,v 1.4 2009/09/10 15:35:05 aclement Exp $
+ * @version $Id: ConstantInteger.java,v 1.5 2009/09/16 00:43:49 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Constant
*/
this.intValue = intValue;
}
- public ConstantInteger(ConstantInteger c) {
- this(c.getValue());
- }
-
ConstantInteger(DataInputStream file) throws IOException {
this(file.readInt());
}
file.writeInt(intValue);
}
- public final void setBytes(int bytes) {
- this.intValue = bytes;
- }
-
@Override
public final String toString() {
return super.toString() + "(bytes = " + intValue + ")";
/**
* This class represents a constant pool reference to an interface method.
*
- * @version $Id: ConstantInterfaceMethodref.java,v 1.4 2009/09/10 15:35:04 aclement Exp $
+ * @version $Id: ConstantInterfaceMethodref.java,v 1.5 2009/09/16 00:43:49 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
public final class ConstantInterfaceMethodref extends ConstantCP {
- public ConstantInterfaceMethodref(ConstantInterfaceMethodref c) {
- super(Constants.CONSTANT_InterfaceMethodref, c.getClassIndex(), c.getNameAndTypeIndex());
- }
-
ConstantInterfaceMethodref(DataInputStream file) throws IOException {
super(Constants.CONSTANT_InterfaceMethodref, file);
}
* This class is derived from the abstract <A HREF="org.aspectj.apache.bcel.classfile.Constant.html">Constant</A> class and
* represents a reference to a long object.
*
- * @version $Id: ConstantLong.java,v 1.4 2009/09/10 15:35:05 aclement Exp $
+ * @version $Id: ConstantLong.java,v 1.5 2009/09/16 00:43:49 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Constant
*/
this.longValue = longValue;
}
- public ConstantLong(ConstantLong c) {
- this(c.getValue());
- }
-
ConstantLong(DataInputStream file) throws IOException {
this(file.readLong());
}
/**
* This class represents a constant pool reference to a method.
*
- * @version $Id: ConstantMethodref.java,v 1.4 2009/09/10 15:35:05 aclement Exp $
+ * @version $Id: ConstantMethodref.java,v 1.5 2009/09/16 00:43:49 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
*/
public final class ConstantMethodref extends ConstantCP {
- /**
- * Initialize from another object.
- */
- public ConstantMethodref(ConstantMethodref c) {
- super(Constants.CONSTANT_Methodref, c.getClassIndex(), c.getNameAndTypeIndex());
- }
- /**
- * Initialize instance from file data.
- *
- * @param file input stream
- * @throws IOException
- */
ConstantMethodref(DataInputStream file) throws IOException {
super(Constants.CONSTANT_Methodref, file);
}
- /**
- * @param class_index Reference to the class containing the method
- * @param name_and_type_index and the method signature
- */
public ConstantMethodref(int class_index, int name_and_type_index) {
super(Constants.CONSTANT_Methodref, class_index, name_and_type_index);
}
- /**
- * Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the
- * hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
- *
- * @param v Visitor object
- */
@Override
public void accept(ClassVisitor v) {
v.visitConstantMethodref(this);
* This class is derived from the abstract <A HREF="org.aspectj.apache.bcel.classfile.Constant.html">Constant</A> class and
* represents a reference to the name and signature of a field or method.
*
- * @version $Id: ConstantNameAndType.java,v 1.4 2009/09/10 15:35:05 aclement Exp $
+ * @version $Id: ConstantNameAndType.java,v 1.5 2009/09/16 00:43:49 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Constant
*/
private int name_index; // Name of field/method
private int signature_index; // and its signature.
- /**
- * Initialize from another object.
- */
- public ConstantNameAndType(ConstantNameAndType c) {
- this(c.getNameIndex(), c.getSignatureIndex());
- }
-
/**
* Initialize instance from file data.
*
return cp.constantToString(getSignatureIndex(), Constants.CONSTANT_Utf8);
}
- /**
- * @param name_index.
- */
- public final void setNameIndex(int name_index) {
- this.name_index = name_index;
- }
-
- /**
- * @param signature_index.
- */
- public final void setSignatureIndex(int signature_index) {
- this.signature_index = signature_index;
- }
-
- /**
- * @return String representation
- */
@Override
public final String toString() {
return super.toString() + "(name_index = " + name_index + ", signature_index = " + signature_index + ")";
* This class is derived from the abstract <A HREF="org.aspectj.apache.bcel.classfile.Constant.html">Constant</A> class and
* represents a reference to a String object.
*
- * @version $Id: ConstantString.java,v 1.4 2009/09/10 15:35:04 aclement Exp $
+ * @version $Id: ConstantString.java,v 1.5 2009/09/16 00:43:49 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Constant
*/
public final class ConstantString extends Constant {
- private int stringIndex;
- public ConstantString(ConstantString c) {
- this(c.getStringIndex());
- }
+ private int stringIndex;
ConstantString(DataInputStream file) throws IOException {
this(file.readUnsignedShort());
* This class is derived from the abstract <A HREF="org.aspectj.apache.bcel.classfile.Constant.html">Constant</A> class and
* represents a reference to a Utf8 encoded string.
*
- * @version $Id: ConstantUtf8.java,v 1.4 2009/09/10 15:35:05 aclement Exp $
+ * @version $Id: ConstantUtf8.java,v 1.5 2009/09/16 00:43:49 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Constant
*/
public final class ConstantUtf8 extends Constant implements SimpleConstant {
private String string;
- public ConstantUtf8(ConstantUtf8 c) {
- this(c.getValue());
- }
-
ConstantUtf8(DataInputStream file) throws IOException {
super(Constants.CONSTANT_Utf8);
string = file.readUTF();
file.writeUTF(string);
}
- public final void setBytes(String bytes) {
- this.string = bytes;
- }
-
@Override
public final String toString() {
return super.toString() + "(\"" + Utility.replace(string, "\n", "\\n") + "\")";
* This class is derived from <em>Attribute</em> and represents a constant value, i.e., a default value for initializing a class
* field. This class is instantiated by the <em>Attribute.readAttribute()</em> method.
*
- * @version $Id: ConstantValue.java,v 1.5 2009/09/15 19:40:12 aclement Exp $
+ * @version $Id: ConstantValue.java,v 1.6 2009/09/16 00:43:49 aclement Exp $
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
* @see Attribute
*/
public final class ConstantValue extends Attribute {
private int constantvalue_index;
- /**
- * Initialize from another object. Note that both objects use the same references (shallow copy). Use clone() for a physical
- * copy.
- */
- public ConstantValue(ConstantValue c) {
- this(c.getNameIndex(), c.getLength(), c.getConstantValueIndex(), c.getConstantPool());
- }
-
- /**
- * Construct object from file stream.
- *
- * @param name_index Name index in constant pool
- * @param length Content length in bytes
- * @param file Input stream
- * @param constant_pool Array of constants
- * @throw IOException
- */
ConstantValue(int name_index, int length, DataInputStream file, ConstantPool constant_pool) throws IOException {
this(name_index, length, file.readUnsignedShort(), constant_pool);
}
- /**
- * @param name_index Name index in constant pool
- * @param length Content length in bytes
- * @param constantvalue_index Index in constant pool
- * @param constant_pool Array of constants
- */
public ConstantValue(int name_index, int length, int constantvalue_index, ConstantPool constant_pool) {
super(Constants.ATTR_CONSTANT_VALUE, name_index, length, constant_pool);
this.constantvalue_index = constantvalue_index;
}
- /**
- * Called by objects that are traversing the nodes of the tree implicitely defined by the contents of a Java class. I.e., the
- * hierarchy of methods, fields, attributes, etc. spawns a tree of objects.
- *
- * @param v Visitor object
- */
@Override
public void accept(ClassVisitor v) {
v.visitConstantValue(this);
}
- /**
- * Dump constant value attribute to file stream on binary format.
- *
- * @param file Output file stream
- * @throws IOException
- */
@Override
public final void dump(DataOutputStream file) throws IOException {
super.dump(file);
file.writeShort(constantvalue_index);
}
- /**
- * @return Index in constant pool of constant value.
- */
public final int getConstantValueIndex() {
return constantvalue_index;
}
- /**
- * @param constantvalue_index.
- */
- public final void setConstantValueIndex(int constantvalue_index) {
- this.constantvalue_index = constantvalue_index;
- }
-
- /**
- * @return String representation of constant value.
- */
@Override
public final String toString() {
Constant c = cpool.getConstant(constantvalue_index);
return buf;
}
- //
- // /**
- // * @return deep copy of this attribute
- // */
- // @Override
- // public Attribute copy(ConstantPool constant_pool) {
- // ConstantValue c = (ConstantValue) clone();
- // c.cpool = constant_pool;
- // return c;
- // }
}