Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants