From ac3b0eee10975b38891f04bbfa08dbbbe8e99823 Mon Sep 17 00:00:00 2001 From: "Philip K. Warren" Date: Thu, 29 Jun 2023 12:50:13 -0500 Subject: [PATCH] compiler: Use fully qualified String in codegen (#10321) 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 #10316. --- .../grpc/io/grpc/alts/internal/HandshakerServiceGrpc.java | 6 +++--- .../grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java | 6 +++--- .../grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java | 6 +++--- .../grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java | 6 +++--- compiler/src/java_plugin/cpp/java_generator.cpp | 6 +++--- compiler/src/test/golden/TestDeprecatedService.java.txt | 6 +++--- compiler/src/test/golden/TestService.java.txt | 6 +++--- compiler/src/testLite/golden/TestDeprecatedService.java.txt | 2 +- compiler/src/testLite/golden/TestService.java.txt | 2 +- .../generated/main/grpc/io/grpc/lb/v1/LoadBalancerGrpc.java | 6 +++--- .../testing/integration/LoadBalancerStatsServiceGrpc.java | 6 +++--- .../io/grpc/testing/integration/MetricsServiceGrpc.java | 6 +++--- .../io/grpc/testing/integration/ReconnectServiceGrpc.java | 6 +++--- .../grpc/io/grpc/testing/integration/TestServiceGrpc.java | 6 +++--- .../grpc/testing/integration/UnimplementedServiceGrpc.java | 6 +++--- .../integration/XdsUpdateClientConfigureServiceGrpc.java | 6 +++--- .../testing/integration/XdsUpdateHealthServiceGrpc.java | 6 +++--- .../main/grpc/io/istio/test/EchoTestServiceGrpc.java | 6 +++--- .../main/grpc/io/grpc/lookup/v1/RouteLookupServiceGrpc.java | 6 +++--- .../main/grpc/io/grpc/channelz/v1/ChannelzGrpc.java | 6 +++--- .../generated/main/grpc/io/grpc/health/v1/HealthGrpc.java | 6 +++--- .../io/grpc/reflection/v1alpha/ServerReflectionGrpc.java | 6 +++--- .../grpc/reflection/testing/AnotherDynamicServiceGrpc.java | 6 +++--- .../reflection/testing/AnotherReflectableServiceGrpc.java | 6 +++--- .../grpc/io/grpc/reflection/testing/DynamicServiceGrpc.java | 6 +++--- .../io/grpc/reflection/testing/ReflectableServiceGrpc.java | 6 +++--- .../grpc/io/grpc/testing/protobuf/SimpleServiceGrpc.java | 6 +++--- .../com/github/xds/service/orca/v3/OpenRcaServiceGrpc.java | 6 +++--- .../envoy/api/v2/ClusterDiscoveryServiceGrpc.java | 6 +++--- .../envoy/api/v2/EndpointDiscoveryServiceGrpc.java | 6 +++--- .../envoy/api/v2/ListenerDiscoveryServiceGrpc.java | 6 +++--- .../envoyproxy/envoy/api/v2/RouteDiscoveryServiceGrpc.java | 6 +++--- .../envoy/api/v2/ScopedRoutesDiscoveryServiceGrpc.java | 6 +++--- .../envoy/api/v2/VirtualHostDiscoveryServiceGrpc.java | 6 +++--- .../discovery/v2/AggregatedDiscoveryServiceGrpc.java | 6 +++--- .../service/discovery/v2/SecretDiscoveryServiceGrpc.java | 6 +++--- .../discovery/v3/AggregatedDiscoveryServiceGrpc.java | 6 +++--- .../service/load_stats/v2/LoadReportingServiceGrpc.java | 6 +++--- .../service/load_stats/v3/LoadReportingServiceGrpc.java | 6 +++--- .../service/status/v3/ClientStatusDiscoveryServiceGrpc.java | 6 +++--- 40 files changed, 116 insertions(+), 116 deletions(-) diff --git a/alts/src/generated/main/grpc/io/grpc/alts/internal/HandshakerServiceGrpc.java b/alts/src/generated/main/grpc/io/grpc/alts/internal/HandshakerServiceGrpc.java index 6e6fdd8f00bc..2caba4a0544e 100644 --- a/alts/src/generated/main/grpc/io/grpc/alts/internal/HandshakerServiceGrpc.java +++ b/alts/src/generated/main/grpc/io/grpc/alts/internal/HandshakerServiceGrpc.java @@ -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.MethodDescriptorPrint( *vars, - "public static final String SERVICE_NAME = " + "public static final $String$ SERVICE_NAME = " "\"$Package$$service_name$\";\n\n"); PrintMethodFields(service, vars, p, flavor); diff --git a/compiler/src/test/golden/TestDeprecatedService.java.txt b/compiler/src/test/golden/TestDeprecatedService.java.txt index 4d7decd76eea..6d11d826560b 100644 --- a/compiler/src/test/golden/TestDeprecatedService.java.txt +++ b/compiler/src/test/golden/TestDeprecatedService.java.txt @@ -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