// Check, that the field don't exist
List fields = clazz.getFields();
Iterator i = fields.iterator();
while(i.hasNext()) {
Field field = (Field)i.next();
if (field.getName().equals(name)) {
throw new FieldExistsException(new JiapiField(field));
}
}
// Add Synthetic attribute for the field
List attrs = new LinkedList();
attrs.add(new SyntheticAttribute(cp));
// Create field, and add it to ClassFile
Field f = new Field(cp, modifiers, name,
TypeHelper.typeToDescriptor(type), attrs);
fields.add(f);
return new JiapiField(f);
}