5
1.2.70-》1.2.83 后偶然出现 is not an interface 的异常
这是代码结构
public static void main(String[] args) {
TypeReference<RespData<Detail>> typeReference = new TypeReference<RespData<Detail>>() {};
String json = "{\"status\":0,\"message\":\"message\",\"data\":{\"test\":\"test\"}}";
RespData<Detail> respData = parseObject(json, typeReference);
System.out.println(respData);
}
public interface Body {}
@Data
static class Detail implements Body {
private String test;
}
@Data
public static class RespData<T extends Body> {
/** 状态码,200为成功,其他值为失败. */
private Integer status;
/** 本次请求结果信息,如果为错误时,即为详细的错误信息. */
private String message;
/** 内容. */
private T data;
}
public static <T extends RespData> T parseObject(String json, TypeReference<T> typeReference) {
T result = JSON.parseObject(json, typeReference);
return result;
}
Originally posted by @AsideIsImp in https://github.com/alibaba/fastjson/issues/4194#issuecomment-1148486377