/** * Return string representation close to declaration format, * `public static final short MAX = 100', e.g.. * * @return String representation of field */ @Override public final String toString() { String name; String signature; String access; // Short cuts to constant pool access = Utility.accessToString(super.getAccessFlags()); access = access.isEmpty() ? "" : (access + " "); signature = super.getType().toString(); name = getName(); final StringBuilder buf = new StringBuilder(32); // CHECKSTYLE IGNORE MagicNumber buf.append(access).append(signature).append(" ").append(name); final String value = getInitValue(); if (value != null) { buf.append(" = ").append(value); } return buf.toString(); }
/** * Return string representation close to declaration format, * `public static void main(String[]) throws IOException', e.g. * * @return String representation of the method. */ @Override public final String toString() { final String access = Utility.accessToString(super.getAccessFlags()); String signature = Type.getMethodSignature(super.getType(), arg_types); signature = Utility.methodSignatureToString(signature, super.getName(), access, true, getLocalVariableTable(super.getConstantPool())); final StringBuilder buf = new StringBuilder(signature); for (final Attribute a : getAttributes()) { if (!((a instanceof Code) || (a instanceof ExceptionTable))) { buf.append(" [").append(a).append("]"); } } if (throws_vec.size() > 0) { for (final String throwsDescriptor : throws_vec) { buf.append("\n\t\tthrows ").append(throwsDescriptor); } } return buf.toString(); }
/** * Get field object after having set up all necessary values. */ public Field getField() { final String signature = getSignature(); final int name_index = super.getConstantPool().addUtf8(super.getName()); final int signature_index = super.getConstantPool().addUtf8(signature); if (value != null) { checkType(super.getType()); final int index = addConstant(); addAttribute(new ConstantValue(super.getConstantPool().addUtf8("ConstantValue"), 2, index, super.getConstantPool().getConstantPool())); // sic } addAnnotationsAsAttribute(super.getConstantPool()); return new Field(super.getAccessFlags(), name_index, signature_index, getAttributes(), super.getConstantPool().getConstantPool()); // sic }
final Method m = new Method(super.getAccessFlags(), name_index, signature_index, getAttributes(), _cp .getConstantPool());