Skip to content

gRPC Java compiler isn't using fully qualified names for String #10316

@pkwarren

Description

@pkwarren

What version of gRPC-Java are you using?

v1.56.0

What is your environment?

Linux, Java 17

What did you expect to see?

Generated code from the gRPC Java compiler should use fully qualified names for String.

What did you see instead?

Compilation error for inputs that include a message type named String.

Steps to reproduce the bug

syntax = "proto3";

package example;

message String {
  string val = 1;
}

message GetThingRequest {
  string id = 1;
}

message GetThingResponse {
  String id = 1;
}

service ExampleService {
  rpc GetThing(GetThingRequest) returns (GetThingResponse);
}

To generate code, I'm using buf with this buf.gen.yaml:

version: v1
managed:
  enabled: true
plugins:
- plugin: buf.build/protocolbuffers/java
  out: gen
- plugin: buf.build/grpc/java
  out: gen

The issue seems to be that the variable here

vars["String"] = "java.lang.String";
isn't being used at the following locations:

I'm happy to raise a PR to fix but I'm having a hard time getting the local build to work end to end on MacOS arm64 and Linux arm64. I imagine this will require not only changing the compiler but also potentially updating tests and regenerating code with the new compiler.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions