You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exception in thread "main" java.lang.ClassCastException: class com.alibaba.fastjson2.JSONObject cannot be cast to class LoginResult (com.alibaba.fastjson2.JSONObject and LoginResult are in unnamed module of loader 'app')
at TestJsonRecord.main(TestJsonRecord.java:24)
附加信息
The text was updated successfully, but these errors were encountered:
问题描述
record类型无法正确识别泛型。
环境信息
请填写以下信息:
重现步骤
如何操作可以重现该问题:
xxx.xxx
方法...
数据...
错误期待的正确结果
输出loginResultAjaxResult 里面data字段的类型,
如果是使用record就会报错,如果使用注释的用法就会正常输出类名,使用record,里面的泛型信息丢失,被反序列化JsonObject
相关日志输出
Exception in thread "main" java.lang.ClassCastException: class com.alibaba.fastjson2.JSONObject cannot be cast to class LoginResult (com.alibaba.fastjson2.JSONObject and LoginResult are in unnamed module of loader 'app')
at TestJsonRecord.main(TestJsonRecord.java:24)
附加信息
The text was updated successfully, but these errors were encountered: