use of org.objectweb.asm.signature.SignatureReader in project jqa-java-plugin by buschmais.
the class ClassVisitor method visitField.
@Override
public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) {
final FieldDescriptor fieldDescriptor = visitorHelper.getFieldDescriptor(cachedType, SignatureHelper.getFieldSignature(name, desc));
fieldDescriptor.setName(name);
fieldDescriptor.setVolatile(hasFlag(access, Opcodes.ACC_VOLATILE));
fieldDescriptor.setTransient(hasFlag(access, Opcodes.ACC_TRANSIENT));
setModifiers(access, fieldDescriptor);
if (signature == null) {
TypeDescriptor type = visitorHelper.resolveType(SignatureHelper.getType((desc)), cachedType).getTypeDescriptor();
fieldDescriptor.setType(type);
} else {
new SignatureReader(signature).accept(new AbstractBoundVisitor(visitorHelper, cachedType) {
@Override
protected void apply(TypeDescriptor rawTypeBound, BoundDescriptor bound) {
fieldDescriptor.setType(rawTypeBound);
fieldDescriptor.setGenericType(bound);
}
});
}
if (value != null) {
if (value instanceof org.objectweb.asm.Type) {
visitorHelper.resolveType(SignatureHelper.getType((org.objectweb.asm.Type) value), cachedType);
}
PrimitiveValueDescriptor valueDescriptor = visitorHelper.getValueDescriptor(PrimitiveValueDescriptor.class);
valueDescriptor.setValue(value);
fieldDescriptor.setValue(valueDescriptor);
}
return new FieldVisitor(cachedType, fieldDescriptor, visitorHelper);
}
Aggregations