I'm digging into The ClassFile
Structure.
According to the document mentioned above, attribute_info
can be appeared in various position.
My question is how can I distinguish the type of attribute_info
s?
I know I can distinguish constant_info
s by their tag
s.
And How can I distinguish attribute_info
s?
All attribute_info
look like this.
attribute_info {
u2 attribute_name_index;
u4 attribute_length;
u1 info[attribute_length];
}
And Fields seems have attribute_info
of ConstantValue
, Synthetic
, and so on.
How can I distinguish their types?
I got it.
The
constant_pool
entry atattribute_name_index
must be aCONSTANT_Utf8_info
structure (§4.4.7) representing the name of the attribute.