|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectharpoon.IR.RawClass.Attribute
harpoon.IR.RawClass.AttributeConstantValue
public class AttributeConstantValue
The ConstantValue
attribute is a fixed-length
attribute used in the attributes
table of the
field_info
structures. A ConstantValue
attribute represents the value of a constant field that must be
(explicitly or implicitly) static
; that is, the
ACC_STATIC
bit in the flags
item of the
field_info
structure must be set. The field is not
required to be final
. There can be no more than one
ConstantValue
attribute in the attributes
table of a given field_info
structure. The constant
field represented by the field_info
structure is
assigned the value referenced by its ConstantValue
attribute as part of its initialization.
CORRECTION FROM ERRATA:
If a non-static field has a ConstantValue
attribute, then
the attribute is silently ignored.
Attribute
,
FieldInfo
,
ClassFile
Field Summary | |
---|---|
static String |
ATTRIBUTE_NAME
The string naming this Attribute type. |
int |
constantvalue_index
The value of the constantvalue_index must be a
valid index into the constant_pool table. |
Fields inherited from class harpoon.IR.RawClass.Attribute |
---|
attribute_name_index, parent |
Constructor Summary | |
---|---|
AttributeConstantValue(ClassFile parent,
int attribute_name_index,
int constantvalue_index)
Constructor. |
Method Summary | |
---|---|
long |
attribute_length()
The value of the attribute_length item indicates
the length of the attribute, excluding the initial six bytes. |
Constant |
constantvalue_index()
|
void |
print(PrintWriter pw,
int indent)
Pretty-print the contents of this attribute. |
void |
write(ClassDataOutputStream out)
Write to bytecode stream. |
Methods inherited from class harpoon.IR.RawClass.Attribute |
---|
attribute_name_index, attribute_name, read, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String ATTRIBUTE_NAME
Attribute
type.
public int constantvalue_index
constantvalue_index
must be a
valid index into the constant_pool
table. The
constant_pool
entry at that index must give the
constant value represented by this attribute. The
constant_pool
entry must be of a type appropriate
to the field.
Constructor Detail |
---|
public AttributeConstantValue(ClassFile parent, int attribute_name_index, int constantvalue_index)
Method Detail |
---|
public long attribute_length()
Attribute
attribute_length
item indicates
the length of the attribute, excluding the initial six bytes.
attribute_length
in class Attribute
public Constant constantvalue_index()
public void write(ClassDataOutputStream out) throws IOException
write
in class Attribute
IOException
public void print(PrintWriter pw, int indent)
print
in class Attribute
indent
- the indentation level to use.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |