Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

[Bug] 泛型字段 deserializeUsing 失效 #3693

Closed
timandy opened this issue Mar 26, 2021 · 1 comment
Closed

[Bug] 泛型字段 deserializeUsing 失效 #3693

timandy opened this issue Mar 26, 2021 · 1 comment

Comments

@timandy
Copy link
Contributor

timandy commented Mar 26, 2021

public void parseField(DefaultJSONParser parser, Object object, Type objectType, Map<String, Object> fieldValues) {
if (this.fieldValueDeserilizer == null) {
getFieldValueDeserilizer(parser.getConfig());
}
ObjectDeserializer fieldValueDeserilizer = this.fieldValueDeserilizer;
Type fieldType = fieldInfo.fieldType;
if (objectType instanceof ParameterizedType) {
ParseContext objContext = parser.getContext();
if (objContext != null) {
objContext.type = objectType;
}
if (fieldType != objectType) {
fieldType = FieldInfo.getFieldType(this.clazz, objectType, fieldType);
fieldValueDeserilizer = parser.getConfig().getDeserializer(fieldType);
}
}

58 行可能通过 deserializeUsing 注解获取过字段上的 Codec , 在 67 行不应该暴力覆盖. 需要判断下当前是否有值,如果为 null 在覆盖.

用例 同
#3008

public class OfficeBean<T> {
    @JSONField(name = "Preference", deserializeUsing = PreferenceDeserializer.class)
    private T preferenceBean;
}
@darren-wang
Copy link

该问题 的修复带来了新的bug:#3810

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants