Skip to content

Conversation

@kabir
Copy link
Collaborator

@kabir kabir commented Dec 24, 2025

The focus is on the APIs users interact with rather than internal classes.

Fixes #476 🦕

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kabir, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the documentation across the client modules of the A2A protocol. The primary goal is to provide developers with clear, comprehensive, and example-rich Javadoc for all public APIs, making it much easier to understand, integrate, and effectively utilize the A2A client library. The focus is on the practical application of the client, covering message handling, task management, and transport configuration in detail.

Highlights

  • Comprehensive Javadoc Additions: Extensive Javadoc comments have been added to all client-side modules, focusing on public APIs and user-facing components. This includes detailed explanations for classes, methods, parameters, return values, and exceptions.
  • Usage Examples and Conceptual Clarity: Many Javadoc entries now include practical code examples to illustrate API usage, along with in-depth explanations of core concepts such as streaming vs. blocking communication, event consumption models, and transport configuration, significantly improving developer onboarding.
  • Enhanced Client Configuration Documentation: The documentation for ClientConfig, ClientBuilder, and various transport configurations (JSON-RPC, gRPC, REST) has been greatly expanded, providing clear guidance on customizing client behavior, transport protocols, and interceptors.
  • Improved Event Handling Explanations: Detailed Javadoc has been added for ClientEvent and its subtypes (MessageEvent, TaskEvent, TaskUpdateEvent), clarifying their roles in the event flow, typical usage patterns, and the differences between event types for better understanding of agent responses.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

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

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 comprehensive Javadoc documentation across the client modules. The added documentation is excellent, with clear explanations, usage examples, and cross-references that will significantly improve the developer experience. I've found a couple of areas for potential improvement in the API design that were highlighted by the new documentation. My specific comments are below. Overall, this is a fantastic contribution to the project's maintainability.

Comment on lines +609 to +626
/**
* Close this client and release all associated resources.
* <p>
* This method closes the underlying transport (HTTP connections, gRPC channels, etc.)
* and releases any other resources held by the client. After calling this method, the
* client instance should not be used further.
* <p>
* <b>Important:</b> Always close clients when done to avoid resource leaks:
* <pre>{@code
* Client client = Client.builder(card)...build();
* try {
* client.sendMessage(...);
* } finally {
* client.close();
* }
* // Or use try-with-resources if Client implements AutoCloseable
* }</pre>
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

The Javadoc for the close() method on line 624 suggests using try-with-resources, which is excellent practice for resource management. To make this possible, the Client class (and its parent AbstractClient) should implement the java.lang.AutoCloseable interface. This would allow users to write cleaner and safer code.

Could you update AbstractClient to implement AutoCloseable? The close() method in AbstractClient doesn't throw any checked exceptions, so it's compatible with AutoCloseable.close().

This change would make the Client class AutoCloseable as well, and the try-with-resources example in the documentation will be directly applicable.

Comment on lines 55 to 62
/**
* Get the list of configured interceptors.
* <p>
* Returns the internal list of interceptors. Modifications to the returned list
* will affect this configuration.
*
* @return the list of configured interceptors (never null, but may be empty)
*/
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This Javadoc correctly states that modifying the returned list will affect the configuration. This design breaks encapsulation and can lead to unexpected behavior. To make the API safer and more robust, getInterceptors() should return an unmodifiable list.

I recommend changing the implementation of getInterceptors() to return java.util.Collections.unmodifiableList(interceptors) and updating this Javadoc to reflect that the returned list is unmodifiable.

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.

[Feat]: Create Javadoc for the common module

1 participant