Skip to content

Commit

Permalink
compiler: Use fully qualified String in codegen (grpc#10321)
Browse files Browse the repository at this point in the history
Currently, the gRPC compiler isn't properly using the fully qualified
string name `java.lang.String` instead of `String`. Update the generator
to use the `$String$` alias to avoid compile issues with protobuf
messages called String.

Fixes grpc#10316.
  • Loading branch information
pkwarren authored and temawi committed Jun 29, 2023
1 parent cdfe8e7 commit ac3b0ee
Show file tree
Hide file tree
Showing 40 changed files with 116 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class HandshakerServiceGrpc {

private HandshakerServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.gcp.HandshakerService";
public static final java.lang.String SERVICE_NAME = "grpc.gcp.HandshakerService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.alts.internal.HandshakerReq,
Expand Down Expand Up @@ -261,9 +261,9 @@ private static final class HandshakerServiceFileDescriptorSupplier
private static final class HandshakerServiceMethodDescriptorSupplier
extends HandshakerServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

HandshakerServiceMethodDescriptorSupplier(String methodName) {
HandshakerServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class BenchmarkServiceGrpc {

private BenchmarkServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.BenchmarkService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.BenchmarkService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Messages.SimpleRequest,
Expand Down Expand Up @@ -552,9 +552,9 @@ private static final class BenchmarkServiceFileDescriptorSupplier
private static final class BenchmarkServiceMethodDescriptorSupplier
extends BenchmarkServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

BenchmarkServiceMethodDescriptorSupplier(String methodName) {
BenchmarkServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class ReportQpsScenarioServiceGrpc {

private ReportQpsScenarioServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.ReportQpsScenarioService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.ReportQpsScenarioService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ScenarioResult,
Expand Down Expand Up @@ -273,9 +273,9 @@ private static final class ReportQpsScenarioServiceFileDescriptorSupplier
private static final class ReportQpsScenarioServiceMethodDescriptorSupplier
extends ReportQpsScenarioServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

ReportQpsScenarioServiceMethodDescriptorSupplier(String methodName) {
ReportQpsScenarioServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class WorkerServiceGrpc {

private WorkerServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.WorkerService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.WorkerService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.benchmarks.proto.Control.ServerArgs,
Expand Down Expand Up @@ -504,9 +504,9 @@ private static final class WorkerServiceFileDescriptorSupplier
private static final class WorkerServiceMethodDescriptorSupplier
extends WorkerServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

WorkerServiceMethodDescriptorSupplier(String methodName) {
WorkerServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
6 changes: 3 additions & 3 deletions compiler/src/java_plugin/cpp/java_generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -989,9 +989,9 @@ static void PrintGetServiceDescriptorMethod(const ServiceDescriptor* service,
"private static final class $proto_method_descriptor_supplier$\n"
" extends $proto_base_descriptor_supplier$\n"
" implements $ProtoMethodDescriptorSupplier$ {\n"
" private final String methodName;\n"
" private final $String$ methodName;\n"
"\n"
" $proto_method_descriptor_supplier$(String methodName) {\n"
" $proto_method_descriptor_supplier$($String$ methodName) {\n"
" this.methodName = methodName;\n"
" }\n"
"\n"
Expand Down Expand Up @@ -1149,7 +1149,7 @@ static void PrintService(const ServiceDescriptor* service,

p->Print(
*vars,
"public static final String SERVICE_NAME = "
"public static final $String$ SERVICE_NAME = "
"\"$Package$$service_name$\";\n\n");

PrintMethodFields(service, vars, p, flavor);
Expand Down
6 changes: 3 additions & 3 deletions compiler/src/test/golden/TestDeprecatedService.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public final class TestDeprecatedServiceGrpc {

private TestDeprecatedServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.compiler.TestDeprecatedService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.compiler.TestDeprecatedService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
Expand Down Expand Up @@ -301,9 +301,9 @@ public final class TestDeprecatedServiceGrpc {
private static final class TestDeprecatedServiceMethodDescriptorSupplier
extends TestDeprecatedServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

TestDeprecatedServiceMethodDescriptorSupplier(String methodName) {
TestDeprecatedServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
6 changes: 3 additions & 3 deletions compiler/src/test/golden/TestService.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public final class TestServiceGrpc {

private TestServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.compiler.TestService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.compiler.TestService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
Expand Down Expand Up @@ -811,9 +811,9 @@ public final class TestServiceGrpc {
private static final class TestServiceMethodDescriptorSupplier
extends TestServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

TestServiceMethodDescriptorSupplier(String methodName) {
TestServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public final class TestDeprecatedServiceGrpc {

private TestDeprecatedServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.compiler.TestDeprecatedService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.compiler.TestDeprecatedService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/testLite/golden/TestService.java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public final class TestServiceGrpc {

private TestServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.compiler.TestService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.compiler.TestService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.compiler.Test.SimpleRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class LoadBalancerGrpc {

private LoadBalancerGrpc() {}

public static final String SERVICE_NAME = "grpc.lb.v1.LoadBalancer";
public static final java.lang.String SERVICE_NAME = "grpc.lb.v1.LoadBalancer";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.lb.v1.LoadBalanceRequest,
Expand Down Expand Up @@ -251,9 +251,9 @@ private static final class LoadBalancerFileDescriptorSupplier
private static final class LoadBalancerMethodDescriptorSupplier
extends LoadBalancerBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

LoadBalancerMethodDescriptorSupplier(String methodName) {
LoadBalancerMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public final class LoadBalancerStatsServiceGrpc {

private LoadBalancerStatsServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.LoadBalancerStatsService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.LoadBalancerStatsService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.LoadBalancerStatsRequest,
Expand Down Expand Up @@ -376,9 +376,9 @@ private static final class LoadBalancerStatsServiceFileDescriptorSupplier
private static final class LoadBalancerStatsServiceMethodDescriptorSupplier
extends LoadBalancerStatsServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

LoadBalancerStatsServiceMethodDescriptorSupplier(String methodName) {
LoadBalancerStatsServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class MetricsServiceGrpc {

private MetricsServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.MetricsService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.MetricsService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.EmptyMessage,
Expand Down Expand Up @@ -351,9 +351,9 @@ private static final class MetricsServiceFileDescriptorSupplier
private static final class MetricsServiceMethodDescriptorSupplier
extends MetricsServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

MetricsServiceMethodDescriptorSupplier(String methodName) {
MetricsServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public final class ReconnectServiceGrpc {

private ReconnectServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.ReconnectService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.ReconnectService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.ReconnectParams,
Expand Down Expand Up @@ -352,9 +352,9 @@ private static final class ReconnectServiceFileDescriptorSupplier
private static final class ReconnectServiceMethodDescriptorSupplier
extends ReconnectServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

ReconnectServiceMethodDescriptorSupplier(String methodName) {
ReconnectServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public final class TestServiceGrpc {

private TestServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.TestService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.TestService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
Expand Down Expand Up @@ -843,9 +843,9 @@ private static final class TestServiceFileDescriptorSupplier
private static final class TestServiceMethodDescriptorSupplier
extends TestServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

TestServiceMethodDescriptorSupplier(String methodName) {
TestServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public final class UnimplementedServiceGrpc {

private UnimplementedServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.UnimplementedService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.UnimplementedService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
Expand Down Expand Up @@ -297,9 +297,9 @@ private static final class UnimplementedServiceFileDescriptorSupplier
private static final class UnimplementedServiceMethodDescriptorSupplier
extends UnimplementedServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

UnimplementedServiceMethodDescriptorSupplier(String methodName) {
UnimplementedServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public final class XdsUpdateClientConfigureServiceGrpc {

private XdsUpdateClientConfigureServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.XdsUpdateClientConfigureService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.XdsUpdateClientConfigureService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Messages.ClientConfigureRequest,
Expand Down Expand Up @@ -291,9 +291,9 @@ private static final class XdsUpdateClientConfigureServiceFileDescriptorSupplier
private static final class XdsUpdateClientConfigureServiceMethodDescriptorSupplier
extends XdsUpdateClientConfigureServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

XdsUpdateClientConfigureServiceMethodDescriptorSupplier(String methodName) {
XdsUpdateClientConfigureServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public final class XdsUpdateHealthServiceGrpc {

private XdsUpdateHealthServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.testing.XdsUpdateHealthService";
public static final java.lang.String SERVICE_NAME = "grpc.testing.XdsUpdateHealthService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.EmptyProtos.Empty,
Expand Down Expand Up @@ -352,9 +352,9 @@ private static final class XdsUpdateHealthServiceFileDescriptorSupplier
private static final class XdsUpdateHealthServiceMethodDescriptorSupplier
extends XdsUpdateHealthServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

XdsUpdateHealthServiceMethodDescriptorSupplier(String methodName) {
XdsUpdateHealthServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class EchoTestServiceGrpc {

private EchoTestServiceGrpc() {}

public static final String SERVICE_NAME = "proto.EchoTestService";
public static final java.lang.String SERVICE_NAME = "proto.EchoTestService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.istio.test.Echo.EchoRequest,
Expand Down Expand Up @@ -334,9 +334,9 @@ private static final class EchoTestServiceFileDescriptorSupplier
private static final class EchoTestServiceMethodDescriptorSupplier
extends EchoTestServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

EchoTestServiceMethodDescriptorSupplier(String methodName) {
EchoTestServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public final class RouteLookupServiceGrpc {

private RouteLookupServiceGrpc() {}

public static final String SERVICE_NAME = "grpc.lookup.v1.RouteLookupService";
public static final java.lang.String SERVICE_NAME = "grpc.lookup.v1.RouteLookupService";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.lookup.v1.RouteLookupRequest,
Expand Down Expand Up @@ -273,9 +273,9 @@ private static final class RouteLookupServiceFileDescriptorSupplier
private static final class RouteLookupServiceMethodDescriptorSupplier
extends RouteLookupServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

RouteLookupServiceMethodDescriptorSupplier(String methodName) {
RouteLookupServiceMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public final class ChannelzGrpc {

private ChannelzGrpc() {}

public static final String SERVICE_NAME = "grpc.channelz.v1.Channelz";
public static final java.lang.String SERVICE_NAME = "grpc.channelz.v1.Channelz";

// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<io.grpc.channelz.v1.GetTopChannelsRequest,
Expand Down Expand Up @@ -811,9 +811,9 @@ private static final class ChannelzFileDescriptorSupplier
private static final class ChannelzMethodDescriptorSupplier
extends ChannelzBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
private final java.lang.String methodName;

ChannelzMethodDescriptorSupplier(String methodName) {
ChannelzMethodDescriptorSupplier(java.lang.String methodName) {
this.methodName = methodName;
}

Expand Down
Loading

0 comments on commit ac3b0ee

Please sign in to comment.