use of com.sun.tools.classfile.ConstantValue_attribute in project ceylon-compiler by ceylon.
the class ClassWriter method writeField.
protected void writeField(Field f) {
if (!options.checkAccess(f.access_flags))
return;
AccessFlags flags = f.access_flags;
writeModifiers(flags.getFieldModifiers());
Signature_attribute sigAttr = getSignature(f.attributes);
if (sigAttr == null)
print(getJavaFieldType(f.descriptor));
else {
try {
Type t = sigAttr.getParsedSignature().getType(constant_pool);
print(getJavaName(t.toString()));
} catch (ConstantPoolException e) {
// report error?
// fall back on non-generic descriptor
print(getJavaFieldType(f.descriptor));
}
}
print(" ");
print(getFieldName(f));
if (options.showConstants && !options.compat) {
// BUG 4111861 print static final field contents
Attribute a = f.attributes.get(Attribute.ConstantValue);
if (a instanceof ConstantValue_attribute) {
print(" = ");
ConstantValue_attribute cv = (ConstantValue_attribute) a;
print(getConstantValue(f.descriptor, cv.constantvalue_index));
}
}
print(";");
println();
indent(+1);
if (options.showInternalSignatures)
println("Signature: " + getValue(f.descriptor));
if (options.verbose && !options.compat)
writeList("flags: ", flags.getFieldFlags(), NEWLINE);
if (options.showAllAttrs) {
for (Attribute attr : f.attributes) attrWriter.write(f, attr, constant_pool);
println();
}
indent(-1);
if (options.showDisassembled || options.showLineAndLocalVariableTables)
println();
}
Aggregations