ConstantValue属性用于表示field_info中的静态变量的初始值,结构如下:
ConstantValue_attribute {u2 attribute_name_index;u4 attribute_length;u2 constantvalue_index;}
ConstantValue解析代码片段:
// 创建属性MapMap<String, Object> attrMap = new LinkedHashMap<>();// u2 constantvalue_index;attrMap.put("constantValue", getConstantPoolValue(dis.readUnsignedShort()));attributeMap.put("ConstantValue", attrMap);
解析后的结果如下:
{"access": 26,"name": "serialVersionUID","desc": "J","attributesCount": 1,"attributes": {"attributeName": "ConstantValue","attributeLength": 2,"ConstantValue": {"constantValue": -7366591802115334000}}}
