CollectFieldData field, TypeParameterLookup typeParamLookup,
int[] nextEnumOrdinal) {
Map<Class<? extends Annotation>, Annotation> declaredAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
resolveAnnotations(logger, field.getAnnotations(), declaredAnnotations);
String name = field.getName();
JField jfield;
if ((field.getAccess() & Opcodes.ACC_ENUM) != 0) {
assert (type.isEnum() != null);
jfield = new JEnumConstant(type, name, declaredAnnotations,
nextEnumOrdinal[0]++);
} else {
jfield = new JField(type, name, declaredAnnotations);
}
// Get modifiers.
//
jfield.addModifierBits(mapBits(ASM_TO_SHARED_MODIFIERS, field.getAccess()));
String signature = field.getSignature();
JType fieldType;
if (signature != null) {
SignatureReader reader = new SignatureReader(signature);
JType[] fieldTypeRef = new JType[1];
reader.acceptType(new ResolveTypeSignature(resolver, binaryMapper,
logger, fieldTypeRef, typeParamLookup, null));
fieldType = fieldTypeRef[0];
// TraceSignatureVisitor trace = new TraceSignatureVisitor(
// methodData.getAccess());
// reader.acceptType(trace);
// System.err.println("Field " + name + ": " + trace.getDeclaration());
} else {
fieldType = resolveType(Type.getType(field.getDesc()));
}
if (fieldType == null) {
return false;
}
jfield.setType(fieldType);
return true;
}