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.StackOverflowError
at java.lang.Class.getEnclosingMethodInfo(Class.java:1072)
at java.lang.Class.getEnclosingClass(Class.java:1272)
at sun.reflect.annotation.AnnotatedTypeFactory.addNesting(AnnotatedTypeFactory.java:96)
at sun.reflect.annotation.AnnotatedTypeFactory.buildAnnotatedType(AnnotatedTypeFactory.java:65)
at sun.reflect.annotation.TypeAnnotationParser.buildAnnotatedTypes(TypeAnnotationParser.java:137)
at java.lang.reflect.Executable.getAnnotatedParameterTypes(Executable.java:688)
at java.lang.reflect.Parameter.getAnnotatedType(Parameter.java:237)
at com.alibaba.fastjson2.writer.ObjectWriter_3.write(Unknown Source)
at com.alibaba.fastjson2.writer.ObjectWriterArray.write(ObjectWriterArray.java:85)
at com.alibaba.fastjson2.writer.ObjectWriter_2.write(Unknown Source)
at com.alibaba.fastjson2.writer.ObjectWriter_3.write(Unknown Source)
The text was updated successfully, but these errors were encountered:
问题描述
使用JSON.toJSONString打印对象时导致StackOverflowError
环境信息
重现步骤
打印类:
@slf4j
@DaTa
测试类:
打印方法:
期待的正确结果
期待不要报错
相关日志输出
Exception in thread "main" java.lang.StackOverflowError
at java.lang.Class.getEnclosingMethodInfo(Class.java:1072)
at java.lang.Class.getEnclosingClass(Class.java:1272)
at sun.reflect.annotation.AnnotatedTypeFactory.addNesting(AnnotatedTypeFactory.java:96)
at sun.reflect.annotation.AnnotatedTypeFactory.buildAnnotatedType(AnnotatedTypeFactory.java:65)
at sun.reflect.annotation.TypeAnnotationParser.buildAnnotatedTypes(TypeAnnotationParser.java:137)
at java.lang.reflect.Executable.getAnnotatedParameterTypes(Executable.java:688)
at java.lang.reflect.Parameter.getAnnotatedType(Parameter.java:237)
at com.alibaba.fastjson2.writer.ObjectWriter_3.write(Unknown Source)
at com.alibaba.fastjson2.writer.ObjectWriterArray.write(ObjectWriterArray.java:85)
at com.alibaba.fastjson2.writer.ObjectWriter_2.write(Unknown Source)
at com.alibaba.fastjson2.writer.ObjectWriter_3.write(Unknown Source)
The text was updated successfully, but these errors were encountered: