Skip to content

fix(core): avoid json-format output invoking constructors. #3111#3116

Merged
hengyunabc merged 1 commit intoalibaba:masterfrom
hengyunabc:fix-3111-json-format-singleton
Dec 26, 2025
Merged

fix(core): avoid json-format output invoking constructors. #3111#3116
hengyunabc merged 1 commit intoalibaba:masterfrom
hengyunabc:fix-3111-json-format-singleton

Conversation

@hengyunabc
Copy link
Collaborator

fastjson2 may create a default instance via no-arg constructor when building
writers, which can trigger side effects (e.g. singleton guards) during
options json-format true.

Use a custom ObjectWriterProvider that disables default value instantiation
and share the JSON config via ObjectView.toJsonString(), reused by
McpObjectVOFilter.

Fixes #3111

fastjson2 may create a default instance via no-arg constructor when building
writers, which can trigger side effects (e.g. singleton guards) during
`options json-format true`.

Use a custom ObjectWriterProvider that disables default value instantiation
and share the JSON config via ObjectView.toJsonString(), reused by
McpObjectVOFilter.

Fixes alibaba#3111
@hengyunabc hengyunabc added this to the 4.1.4 milestone Dec 26, 2025
@hengyunabc hengyunabc merged commit d499f65 into alibaba:master Dec 26, 2025
24 of 25 checks passed
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

Successfully merging this pull request may close these issues.

Arthas的getInstances破坏单例

1 participant