Skip to content

fix: add no-args constructors to response/request classes for Gson compa…#937

Open
kabir wants to merge 1 commit into
a2aproject:mainfrom
kabir:default-constructors
Open

fix: add no-args constructors to response/request classes for Gson compa…#937
kabir wants to merge 1 commit into
a2aproject:mainfrom
kabir:default-constructors

Conversation

@kabir

@kabir kabir commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

…tibility

Gson's reflective adapter falls back to sun.misc.Unsafe.allocateInstance() when no no-args constructor is available. This fails in modular environments like WildFly's JBoss Modules. Adding no-args constructors lets Gson instantiate these classes directly without Unsafe.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds public no-arguments constructors to several JSON-RPC response classes in the compat-0.3 specification package. The reviewer suggests changing these constructors from public to private to prevent external callers from instantiating the classes in an invalid state, while still allowing libraries like Gson to access them via reflection.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

…n compatibility

Gson's reflective adapter falls back to sun.misc.Unsafe.allocateInstance()
when no no-args constructor is available. This fails in modular environments
like WildFly's JBoss Modules. Adding no-args constructors lets Gson
instantiate these classes directly without Unsafe.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@kabir kabir force-pushed the default-constructors branch from 1100678 to b854790 Compare June 17, 2026 15:15
@kabir kabir changed the title fix: add no-args constructors to v0.3 response classes for Gson compa… fix: add no-args constructors to response/request classes for Gson compa… Jun 17, 2026
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.

1 participant