Skip to content

Conversation

shivaspeaks
Copy link
Member

@shivaspeaks shivaspeaks commented Sep 4, 2025

Generated gRPC method names in the BlockingV2Stub can conflict with
final methods on java.lang.Object (e.g., toString(), hashCode())
for client-streaming and bidi-streaming RPCs. This occurs because
they are generated with no arguments, leading to a compilation error. One such case in #12331.

This change introduces a dedicated list of no-argument method names
from java.lang.Object and applies name-mangling (appending an
underscore) only when generating these specific methods in the
v2 blocking stub.

This resolves the compilation failure while ensuring that the behavior
for all other stubs remains unchanged.

Fixes: #12331

Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

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

We should have this be a separate list. The current list is keywords. This new list should be limited to "methods on Object that have void arguments."

@shivaspeaks shivaspeaks requested a review from ejona86 September 7, 2025 07:48
@shivaspeaks shivaspeaks requested a review from ejona86 September 10, 2025 16:56
@shivaspeaks shivaspeaks added the kokoro:force-run Add this label to a PR to tell Kokoro to re-run all tests. Not generally necessary label Sep 12, 2025
@grpc-kokoro grpc-kokoro removed the kokoro:force-run Add this label to a PR to tell Kokoro to re-run all tests. Not generally necessary label Sep 12, 2025
@shivaspeaks shivaspeaks requested a review from ejona86 September 12, 2025 07:16
@shivaspeaks shivaspeaks merged commit 866d226 into grpc:master Sep 13, 2025
22 of 23 checks passed
@shivaspeaks shivaspeaks deleted the java-keywords branch September 13, 2025 06:24
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.

Since 1.70.0, generated code fails to compile when certain streaming service method names conflict
4 participants