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 a7a98e459f..5295a21b6b 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 @@ -30,6 +30,12 @@ public final class HandshakerServiceGrpc { private static volatile io.grpc.MethodDescriptor getDoHandshakeMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.gcp.HandshakerService", + methodName = "DoHandshake", + inputType = io.grpc.alts.internal.Handshaker.HandshakerReq.class, + outputType = io.grpc.alts.internal.Handshaker.HandshakerResp.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getDoHandshakeMethod() { io.grpc.MethodDescriptor getDoHandshakeMethod; diff --git a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java index 82cb5b2b0f..6be515010b 100644 --- a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java +++ b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/BenchmarkServiceGrpc.java @@ -30,6 +30,12 @@ public final class BenchmarkServiceGrpc { private static volatile io.grpc.MethodDescriptor getUnaryCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.BenchmarkService", + methodName = "UnaryCall", + inputType = io.grpc.benchmarks.proto.Messages.SimpleRequest.class, + outputType = io.grpc.benchmarks.proto.Messages.SimpleResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getUnaryCallMethod() { io.grpc.MethodDescriptor getUnaryCallMethod; @@ -57,6 +63,12 @@ public final class BenchmarkServiceGrpc { private static volatile io.grpc.MethodDescriptor getStreamingCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.BenchmarkService", + methodName = "StreamingCall", + inputType = io.grpc.benchmarks.proto.Messages.SimpleRequest.class, + outputType = io.grpc.benchmarks.proto.Messages.SimpleResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getStreamingCallMethod() { io.grpc.MethodDescriptor getStreamingCallMethod; @@ -84,6 +96,12 @@ public final class BenchmarkServiceGrpc { private static volatile io.grpc.MethodDescriptor getStreamingFromClientMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.BenchmarkService", + methodName = "StreamingFromClient", + inputType = io.grpc.benchmarks.proto.Messages.SimpleRequest.class, + outputType = io.grpc.benchmarks.proto.Messages.SimpleResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING) public static io.grpc.MethodDescriptor getStreamingFromClientMethod() { io.grpc.MethodDescriptor getStreamingFromClientMethod; @@ -111,6 +129,12 @@ public final class BenchmarkServiceGrpc { private static volatile io.grpc.MethodDescriptor getStreamingFromServerMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.BenchmarkService", + methodName = "StreamingFromServer", + inputType = io.grpc.benchmarks.proto.Messages.SimpleRequest.class, + outputType = io.grpc.benchmarks.proto.Messages.SimpleResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) public static io.grpc.MethodDescriptor getStreamingFromServerMethod() { io.grpc.MethodDescriptor getStreamingFromServerMethod; @@ -138,6 +162,12 @@ public final class BenchmarkServiceGrpc { private static volatile io.grpc.MethodDescriptor getStreamingBothWaysMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.BenchmarkService", + methodName = "StreamingBothWays", + inputType = io.grpc.benchmarks.proto.Messages.SimpleRequest.class, + outputType = io.grpc.benchmarks.proto.Messages.SimpleResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getStreamingBothWaysMethod() { io.grpc.MethodDescriptor getStreamingBothWaysMethod; diff --git a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java index 8a0cc45e00..3eb572cca9 100644 --- a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java +++ b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/ReportQpsScenarioServiceGrpc.java @@ -30,6 +30,12 @@ public final class ReportQpsScenarioServiceGrpc { private static volatile io.grpc.MethodDescriptor getReportScenarioMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.ReportQpsScenarioService", + methodName = "ReportScenario", + inputType = io.grpc.benchmarks.proto.Control.ScenarioResult.class, + outputType = io.grpc.benchmarks.proto.Control.Void.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getReportScenarioMethod() { io.grpc.MethodDescriptor getReportScenarioMethod; diff --git a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java index eb83c18826..1db4066c4e 100644 --- a/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java +++ b/benchmarks/src/generated/main/grpc/io/grpc/benchmarks/proto/WorkerServiceGrpc.java @@ -30,6 +30,12 @@ public final class WorkerServiceGrpc { private static volatile io.grpc.MethodDescriptor getRunServerMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.WorkerService", + methodName = "RunServer", + inputType = io.grpc.benchmarks.proto.Control.ServerArgs.class, + outputType = io.grpc.benchmarks.proto.Control.ServerStatus.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getRunServerMethod() { io.grpc.MethodDescriptor getRunServerMethod; @@ -57,6 +63,12 @@ public final class WorkerServiceGrpc { private static volatile io.grpc.MethodDescriptor getRunClientMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.WorkerService", + methodName = "RunClient", + inputType = io.grpc.benchmarks.proto.Control.ClientArgs.class, + outputType = io.grpc.benchmarks.proto.Control.ClientStatus.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getRunClientMethod() { io.grpc.MethodDescriptor getRunClientMethod; @@ -84,6 +96,12 @@ public final class WorkerServiceGrpc { private static volatile io.grpc.MethodDescriptor getCoreCountMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.WorkerService", + methodName = "CoreCount", + inputType = io.grpc.benchmarks.proto.Control.CoreRequest.class, + outputType = io.grpc.benchmarks.proto.Control.CoreResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getCoreCountMethod() { io.grpc.MethodDescriptor getCoreCountMethod; @@ -111,6 +129,12 @@ public final class WorkerServiceGrpc { private static volatile io.grpc.MethodDescriptor getQuitWorkerMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.WorkerService", + methodName = "QuitWorker", + inputType = io.grpc.benchmarks.proto.Control.Void.class, + outputType = io.grpc.benchmarks.proto.Control.Void.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getQuitWorkerMethod() { io.grpc.MethodDescriptor getQuitWorkerMethod; diff --git a/compiler/src/java_plugin/cpp/java_generator.cpp b/compiler/src/java_plugin/cpp/java_generator.cpp index 51a3ba01f9..8a55bebdef 100644 --- a/compiler/src/java_plugin/cpp/java_generator.cpp +++ b/compiler/src/java_plugin/cpp/java_generator.cpp @@ -477,6 +477,12 @@ static void PrintMethodFields( "private static volatile $MethodDescriptor$<$input_type$,\n" " $output_type$> $method_new_field_name$;\n" "\n" + "@$RpcMethod$(\n" + " fullServiceName = \"$Package$$service_name$\",\n" + " methodName = \"$method_name$\",\n" + " inputType = $input_type$.class,\n" + " outputType = $output_type$.class,\n" + " methodType = $MethodType$.$method_type$)\n" "public static $MethodDescriptor$<$input_type$,\n" " $output_type$> $method_method_name$() {\n" " $MethodDescriptor$<$input_type$, $output_type$> $method_new_field_name$;\n" @@ -1275,6 +1281,7 @@ void GenerateService(const ServiceDescriptor* service, vars["ProtoMethodDescriptorSupplier"] = "io.grpc.protobuf.ProtoMethodDescriptorSupplier"; vars["AbstractStub"] = "io.grpc.stub.AbstractStub"; + vars["RpcMethod"] = "io.grpc.stub.annotations.RpcMethod"; vars["MethodDescriptor"] = "io.grpc.MethodDescriptor"; vars["NanoUtils"] = "io.grpc.protobuf.nano.NanoUtils"; vars["StreamObserver"] = "io.grpc.stub.StreamObserver"; diff --git a/compiler/src/test/golden/TestService.java.txt b/compiler/src/test/golden/TestService.java.txt index 401ea41936..8d40a93ec5 100644 --- a/compiler/src/test/golden/TestService.java.txt +++ b/compiler/src/test/golden/TestService.java.txt @@ -33,6 +33,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getUnaryCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.compiler.TestService", + methodName = "UnaryCall", + inputType = io.grpc.testing.compiler.Test.SimpleRequest.class, + outputType = io.grpc.testing.compiler.Test.SimpleResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getUnaryCallMethod() { io.grpc.MethodDescriptor getUnaryCallMethod; @@ -60,6 +66,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getStreamingOutputCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.compiler.TestService", + methodName = "StreamingOutputCall", + inputType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class, + outputType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) public static io.grpc.MethodDescriptor getStreamingOutputCallMethod() { io.grpc.MethodDescriptor getStreamingOutputCallMethod; @@ -87,6 +99,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getStreamingInputCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.compiler.TestService", + methodName = "StreamingInputCall", + inputType = io.grpc.testing.compiler.Test.StreamingInputCallRequest.class, + outputType = io.grpc.testing.compiler.Test.StreamingInputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING) public static io.grpc.MethodDescriptor getStreamingInputCallMethod() { io.grpc.MethodDescriptor getStreamingInputCallMethod; @@ -114,6 +132,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getFullBidiCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.compiler.TestService", + methodName = "FullBidiCall", + inputType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class, + outputType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getFullBidiCallMethod() { io.grpc.MethodDescriptor getFullBidiCallMethod; @@ -141,6 +165,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getHalfBidiCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.compiler.TestService", + methodName = "HalfBidiCall", + inputType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class, + outputType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getHalfBidiCallMethod() { io.grpc.MethodDescriptor getHalfBidiCallMethod; @@ -168,6 +198,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getImportMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.compiler.TestService", + methodName = "Import", + inputType = io.grpc.testing.compiler.Test.StreamingInputCallRequest.class, + outputType = io.grpc.testing.compiler.Test.StreamingInputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getImportMethod() { io.grpc.MethodDescriptor getImportMethod; diff --git a/compiler/src/testLite/golden/TestService.java.txt b/compiler/src/testLite/golden/TestService.java.txt index c00145b0d2..7f6ab0ae4c 100644 --- a/compiler/src/testLite/golden/TestService.java.txt +++ b/compiler/src/testLite/golden/TestService.java.txt @@ -33,6 +33,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getUnaryCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.compiler.TestService", + methodName = "UnaryCall", + inputType = io.grpc.testing.compiler.Test.SimpleRequest.class, + outputType = io.grpc.testing.compiler.Test.SimpleResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getUnaryCallMethod() { io.grpc.MethodDescriptor getUnaryCallMethod; @@ -59,6 +65,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getStreamingOutputCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.compiler.TestService", + methodName = "StreamingOutputCall", + inputType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class, + outputType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) public static io.grpc.MethodDescriptor getStreamingOutputCallMethod() { io.grpc.MethodDescriptor getStreamingOutputCallMethod; @@ -85,6 +97,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getStreamingInputCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.compiler.TestService", + methodName = "StreamingInputCall", + inputType = io.grpc.testing.compiler.Test.StreamingInputCallRequest.class, + outputType = io.grpc.testing.compiler.Test.StreamingInputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING) public static io.grpc.MethodDescriptor getStreamingInputCallMethod() { io.grpc.MethodDescriptor getStreamingInputCallMethod; @@ -111,6 +129,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getFullBidiCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.compiler.TestService", + methodName = "FullBidiCall", + inputType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class, + outputType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getFullBidiCallMethod() { io.grpc.MethodDescriptor getFullBidiCallMethod; @@ -137,6 +161,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getHalfBidiCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.compiler.TestService", + methodName = "HalfBidiCall", + inputType = io.grpc.testing.compiler.Test.StreamingOutputCallRequest.class, + outputType = io.grpc.testing.compiler.Test.StreamingOutputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getHalfBidiCallMethod() { io.grpc.MethodDescriptor getHalfBidiCallMethod; @@ -163,6 +193,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getImportMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.compiler.TestService", + methodName = "Import", + inputType = io.grpc.testing.compiler.Test.StreamingInputCallRequest.class, + outputType = io.grpc.testing.compiler.Test.StreamingInputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getImportMethod() { io.grpc.MethodDescriptor getImportMethod; diff --git a/grpclb/src/generated/main/grpc/io/grpc/grpclb/LoadBalancerGrpc.java b/grpclb/src/generated/main/grpc/io/grpc/grpclb/LoadBalancerGrpc.java index 72952237fe..8ff135f0de 100644 --- a/grpclb/src/generated/main/grpc/io/grpc/grpclb/LoadBalancerGrpc.java +++ b/grpclb/src/generated/main/grpc/io/grpc/grpclb/LoadBalancerGrpc.java @@ -30,6 +30,12 @@ public final class LoadBalancerGrpc { private static volatile io.grpc.MethodDescriptor getBalanceLoadMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.lb.v1.LoadBalancer", + methodName = "BalanceLoad", + inputType = io.grpc.grpclb.LoadBalanceRequest.class, + outputType = io.grpc.grpclb.LoadBalanceResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getBalanceLoadMethod() { io.grpc.MethodDescriptor getBalanceLoadMethod; diff --git a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java index 957b38ba7c..49e5eaf64c 100644 --- a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java +++ b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java @@ -30,6 +30,12 @@ public final class MetricsServiceGrpc { private static volatile io.grpc.MethodDescriptor getGetAllGaugesMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.MetricsService", + methodName = "GetAllGauges", + inputType = io.grpc.testing.integration.Metrics.EmptyMessage.class, + outputType = io.grpc.testing.integration.Metrics.GaugeResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) public static io.grpc.MethodDescriptor getGetAllGaugesMethod() { io.grpc.MethodDescriptor getGetAllGaugesMethod; @@ -57,6 +63,12 @@ public final class MetricsServiceGrpc { private static volatile io.grpc.MethodDescriptor getGetGaugeMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.MetricsService", + methodName = "GetGauge", + inputType = io.grpc.testing.integration.Metrics.GaugeRequest.class, + outputType = io.grpc.testing.integration.Metrics.GaugeResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getGetGaugeMethod() { io.grpc.MethodDescriptor getGetGaugeMethod; diff --git a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java index 6f44abb294..38e53638bd 100644 --- a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java +++ b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java @@ -33,6 +33,12 @@ public final class ReconnectServiceGrpc { private static volatile io.grpc.MethodDescriptor getStartMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.ReconnectService", + methodName = "Start", + inputType = io.grpc.testing.integration.EmptyProtos.Empty.class, + outputType = io.grpc.testing.integration.EmptyProtos.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getStartMethod() { io.grpc.MethodDescriptor getStartMethod; @@ -60,6 +66,12 @@ public final class ReconnectServiceGrpc { private static volatile io.grpc.MethodDescriptor getStopMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.ReconnectService", + methodName = "Stop", + inputType = io.grpc.testing.integration.EmptyProtos.Empty.class, + outputType = io.grpc.testing.integration.Messages.ReconnectInfo.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getStopMethod() { io.grpc.MethodDescriptor getStopMethod; diff --git a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java index d19d6db255..84bf864db0 100644 --- a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java +++ b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/TestServiceGrpc.java @@ -34,6 +34,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getEmptyCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.TestService", + methodName = "EmptyCall", + inputType = io.grpc.testing.integration.EmptyProtos.Empty.class, + outputType = io.grpc.testing.integration.EmptyProtos.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getEmptyCallMethod() { io.grpc.MethodDescriptor getEmptyCallMethod; @@ -61,6 +67,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getUnaryCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.TestService", + methodName = "UnaryCall", + inputType = io.grpc.testing.integration.Messages.SimpleRequest.class, + outputType = io.grpc.testing.integration.Messages.SimpleResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getUnaryCallMethod() { io.grpc.MethodDescriptor getUnaryCallMethod; @@ -88,6 +100,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getCacheableUnaryCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.TestService", + methodName = "CacheableUnaryCall", + inputType = io.grpc.testing.integration.Messages.SimpleRequest.class, + outputType = io.grpc.testing.integration.Messages.SimpleResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getCacheableUnaryCallMethod() { io.grpc.MethodDescriptor getCacheableUnaryCallMethod; @@ -115,6 +133,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getStreamingOutputCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.TestService", + methodName = "StreamingOutputCall", + inputType = io.grpc.testing.integration.Messages.StreamingOutputCallRequest.class, + outputType = io.grpc.testing.integration.Messages.StreamingOutputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) public static io.grpc.MethodDescriptor getStreamingOutputCallMethod() { io.grpc.MethodDescriptor getStreamingOutputCallMethod; @@ -142,6 +166,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getStreamingInputCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.TestService", + methodName = "StreamingInputCall", + inputType = io.grpc.testing.integration.Messages.StreamingInputCallRequest.class, + outputType = io.grpc.testing.integration.Messages.StreamingInputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING) public static io.grpc.MethodDescriptor getStreamingInputCallMethod() { io.grpc.MethodDescriptor getStreamingInputCallMethod; @@ -169,6 +199,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getFullDuplexCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.TestService", + methodName = "FullDuplexCall", + inputType = io.grpc.testing.integration.Messages.StreamingOutputCallRequest.class, + outputType = io.grpc.testing.integration.Messages.StreamingOutputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getFullDuplexCallMethod() { io.grpc.MethodDescriptor getFullDuplexCallMethod; @@ -196,6 +232,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getHalfDuplexCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.TestService", + methodName = "HalfDuplexCall", + inputType = io.grpc.testing.integration.Messages.StreamingOutputCallRequest.class, + outputType = io.grpc.testing.integration.Messages.StreamingOutputCallResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getHalfDuplexCallMethod() { io.grpc.MethodDescriptor getHalfDuplexCallMethod; @@ -223,6 +265,12 @@ public final class TestServiceGrpc { private static volatile io.grpc.MethodDescriptor getUnimplementedCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.TestService", + methodName = "UnimplementedCall", + inputType = io.grpc.testing.integration.EmptyProtos.Empty.class, + outputType = io.grpc.testing.integration.EmptyProtos.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getUnimplementedCallMethod() { io.grpc.MethodDescriptor getUnimplementedCallMethod; diff --git a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java index c2d7578ed3..aa3c7414dc 100644 --- a/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java +++ b/interop-testing/src/generated/main/grpc/io/grpc/testing/integration/UnimplementedServiceGrpc.java @@ -34,6 +34,12 @@ public final class UnimplementedServiceGrpc { private static volatile io.grpc.MethodDescriptor getUnimplementedCallMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.UnimplementedService", + methodName = "UnimplementedCall", + inputType = io.grpc.testing.integration.EmptyProtos.Empty.class, + outputType = io.grpc.testing.integration.EmptyProtos.Empty.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getUnimplementedCallMethod() { io.grpc.MethodDescriptor getUnimplementedCallMethod; diff --git a/services/src/generated/main/grpc/io/grpc/channelz/v1/ChannelzGrpc.java b/services/src/generated/main/grpc/io/grpc/channelz/v1/ChannelzGrpc.java index 142289c28f..a85bc8a8e9 100644 --- a/services/src/generated/main/grpc/io/grpc/channelz/v1/ChannelzGrpc.java +++ b/services/src/generated/main/grpc/io/grpc/channelz/v1/ChannelzGrpc.java @@ -34,6 +34,12 @@ public final class ChannelzGrpc { private static volatile io.grpc.MethodDescriptor getGetTopChannelsMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.channelz.v1.Channelz", + methodName = "GetTopChannels", + inputType = io.grpc.channelz.v1.GetTopChannelsRequest.class, + outputType = io.grpc.channelz.v1.GetTopChannelsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getGetTopChannelsMethod() { io.grpc.MethodDescriptor getGetTopChannelsMethod; @@ -61,6 +67,12 @@ public final class ChannelzGrpc { private static volatile io.grpc.MethodDescriptor getGetServersMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.channelz.v1.Channelz", + methodName = "GetServers", + inputType = io.grpc.channelz.v1.GetServersRequest.class, + outputType = io.grpc.channelz.v1.GetServersResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getGetServersMethod() { io.grpc.MethodDescriptor getGetServersMethod; @@ -88,6 +100,12 @@ public final class ChannelzGrpc { private static volatile io.grpc.MethodDescriptor getGetServerSocketsMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.channelz.v1.Channelz", + methodName = "GetServerSockets", + inputType = io.grpc.channelz.v1.GetServerSocketsRequest.class, + outputType = io.grpc.channelz.v1.GetServerSocketsResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getGetServerSocketsMethod() { io.grpc.MethodDescriptor getGetServerSocketsMethod; @@ -115,6 +133,12 @@ public final class ChannelzGrpc { private static volatile io.grpc.MethodDescriptor getGetChannelMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.channelz.v1.Channelz", + methodName = "GetChannel", + inputType = io.grpc.channelz.v1.GetChannelRequest.class, + outputType = io.grpc.channelz.v1.GetChannelResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getGetChannelMethod() { io.grpc.MethodDescriptor getGetChannelMethod; @@ -142,6 +166,12 @@ public final class ChannelzGrpc { private static volatile io.grpc.MethodDescriptor getGetSubchannelMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.channelz.v1.Channelz", + methodName = "GetSubchannel", + inputType = io.grpc.channelz.v1.GetSubchannelRequest.class, + outputType = io.grpc.channelz.v1.GetSubchannelResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getGetSubchannelMethod() { io.grpc.MethodDescriptor getGetSubchannelMethod; @@ -169,6 +199,12 @@ public final class ChannelzGrpc { private static volatile io.grpc.MethodDescriptor getGetSocketMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.channelz.v1.Channelz", + methodName = "GetSocket", + inputType = io.grpc.channelz.v1.GetSocketRequest.class, + outputType = io.grpc.channelz.v1.GetSocketResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getGetSocketMethod() { io.grpc.MethodDescriptor getGetSocketMethod; diff --git a/services/src/generated/main/grpc/io/grpc/health/v1/HealthGrpc.java b/services/src/generated/main/grpc/io/grpc/health/v1/HealthGrpc.java index d574b81237..0ec948320f 100644 --- a/services/src/generated/main/grpc/io/grpc/health/v1/HealthGrpc.java +++ b/services/src/generated/main/grpc/io/grpc/health/v1/HealthGrpc.java @@ -30,6 +30,12 @@ public final class HealthGrpc { private static volatile io.grpc.MethodDescriptor getCheckMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.health.v1.Health", + methodName = "Check", + inputType = io.grpc.health.v1.HealthCheckRequest.class, + outputType = io.grpc.health.v1.HealthCheckResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getCheckMethod() { io.grpc.MethodDescriptor getCheckMethod; diff --git a/services/src/generated/main/grpc/io/grpc/reflection/v1alpha/ServerReflectionGrpc.java b/services/src/generated/main/grpc/io/grpc/reflection/v1alpha/ServerReflectionGrpc.java index 9c30d770f3..273f458686 100644 --- a/services/src/generated/main/grpc/io/grpc/reflection/v1alpha/ServerReflectionGrpc.java +++ b/services/src/generated/main/grpc/io/grpc/reflection/v1alpha/ServerReflectionGrpc.java @@ -30,6 +30,12 @@ public final class ServerReflectionGrpc { private static volatile io.grpc.MethodDescriptor getServerReflectionInfoMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.reflection.v1alpha.ServerReflection", + methodName = "ServerReflectionInfo", + inputType = io.grpc.reflection.v1alpha.ServerReflectionRequest.class, + outputType = io.grpc.reflection.v1alpha.ServerReflectionResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getServerReflectionInfoMethod() { io.grpc.MethodDescriptor getServerReflectionInfoMethod; diff --git a/services/src/generated/test/grpc/io/grpc/reflection/testing/AnotherDynamicServiceGrpc.java b/services/src/generated/test/grpc/io/grpc/reflection/testing/AnotherDynamicServiceGrpc.java index 106a64b8ba..786c8b6c30 100644 --- a/services/src/generated/test/grpc/io/grpc/reflection/testing/AnotherDynamicServiceGrpc.java +++ b/services/src/generated/test/grpc/io/grpc/reflection/testing/AnotherDynamicServiceGrpc.java @@ -33,6 +33,12 @@ public final class AnotherDynamicServiceGrpc { private static volatile io.grpc.MethodDescriptor getMethodMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.reflection.testing.AnotherDynamicService", + methodName = "Method", + inputType = io.grpc.reflection.testing.DynamicRequest.class, + outputType = io.grpc.reflection.testing.DynamicReply.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getMethodMethod() { io.grpc.MethodDescriptor getMethodMethod; diff --git a/services/src/generated/test/grpc/io/grpc/reflection/testing/DynamicServiceGrpc.java b/services/src/generated/test/grpc/io/grpc/reflection/testing/DynamicServiceGrpc.java index 69066bf73f..9909078d88 100644 --- a/services/src/generated/test/grpc/io/grpc/reflection/testing/DynamicServiceGrpc.java +++ b/services/src/generated/test/grpc/io/grpc/reflection/testing/DynamicServiceGrpc.java @@ -33,6 +33,12 @@ public final class DynamicServiceGrpc { private static volatile io.grpc.MethodDescriptor getMethodMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.reflection.testing.DynamicService", + methodName = "Method", + inputType = io.grpc.reflection.testing.DynamicRequest.class, + outputType = io.grpc.reflection.testing.DynamicReply.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getMethodMethod() { io.grpc.MethodDescriptor getMethodMethod; diff --git a/services/src/generated/test/grpc/io/grpc/reflection/testing/ReflectableServiceGrpc.java b/services/src/generated/test/grpc/io/grpc/reflection/testing/ReflectableServiceGrpc.java index 48c4f98c7c..097ea29184 100644 --- a/services/src/generated/test/grpc/io/grpc/reflection/testing/ReflectableServiceGrpc.java +++ b/services/src/generated/test/grpc/io/grpc/reflection/testing/ReflectableServiceGrpc.java @@ -30,6 +30,12 @@ public final class ReflectableServiceGrpc { private static volatile io.grpc.MethodDescriptor getMethodMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.reflection.testing.ReflectableService", + methodName = "Method", + inputType = io.grpc.reflection.testing.Request.class, + outputType = io.grpc.reflection.testing.Reply.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getMethodMethod() { io.grpc.MethodDescriptor getMethodMethod; diff --git a/stub/src/main/java/io/grpc/stub/annotations/RpcMethod.java b/stub/src/main/java/io/grpc/stub/annotations/RpcMethod.java new file mode 100644 index 0000000000..5d8591f58e --- /dev/null +++ b/stub/src/main/java/io/grpc/stub/annotations/RpcMethod.java @@ -0,0 +1,56 @@ +/* + * Copyright 2018 The gRPC Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.grpc.stub.annotations; + +import io.grpc.MethodDescriptor.MethodType; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Annotates a method descriptor method to provide metadata for annotation processing. + */ +@Retention(RetentionPolicy.CLASS) +@Target(ElementType.METHOD) +public @interface RpcMethod { + + /** + * The full service name for the method + */ + String fullServiceName(); + + /** + * The method name for the method + */ + String methodName(); + + /** + * The input type of the method + */ + Class inputType(); + + /** + * The output type of the method + */ + Class outputType(); + + /** + * The call type of the method + */ + MethodType methodType(); +} diff --git a/testing-proto/src/generated/main/grpc/io/grpc/testing/protobuf/SimpleServiceGrpc.java b/testing-proto/src/generated/main/grpc/io/grpc/testing/protobuf/SimpleServiceGrpc.java index 713525d696..7aaece01b5 100644 --- a/testing-proto/src/generated/main/grpc/io/grpc/testing/protobuf/SimpleServiceGrpc.java +++ b/testing-proto/src/generated/main/grpc/io/grpc/testing/protobuf/SimpleServiceGrpc.java @@ -33,6 +33,12 @@ public final class SimpleServiceGrpc { private static volatile io.grpc.MethodDescriptor getUnaryRpcMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.SimpleService", + methodName = "UnaryRpc", + inputType = io.grpc.testing.protobuf.SimpleRequest.class, + outputType = io.grpc.testing.protobuf.SimpleResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.UNARY) public static io.grpc.MethodDescriptor getUnaryRpcMethod() { io.grpc.MethodDescriptor getUnaryRpcMethod; @@ -60,6 +66,12 @@ public final class SimpleServiceGrpc { private static volatile io.grpc.MethodDescriptor getClientStreamingRpcMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.SimpleService", + methodName = "ClientStreamingRpc", + inputType = io.grpc.testing.protobuf.SimpleRequest.class, + outputType = io.grpc.testing.protobuf.SimpleResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.CLIENT_STREAMING) public static io.grpc.MethodDescriptor getClientStreamingRpcMethod() { io.grpc.MethodDescriptor getClientStreamingRpcMethod; @@ -87,6 +99,12 @@ public final class SimpleServiceGrpc { private static volatile io.grpc.MethodDescriptor getServerStreamingRpcMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.SimpleService", + methodName = "ServerStreamingRpc", + inputType = io.grpc.testing.protobuf.SimpleRequest.class, + outputType = io.grpc.testing.protobuf.SimpleResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING) public static io.grpc.MethodDescriptor getServerStreamingRpcMethod() { io.grpc.MethodDescriptor getServerStreamingRpcMethod; @@ -114,6 +132,12 @@ public final class SimpleServiceGrpc { private static volatile io.grpc.MethodDescriptor getBidiStreamingRpcMethod; + @io.grpc.stub.annotations.RpcMethod( + fullServiceName = "grpc.testing.SimpleService", + methodName = "BidiStreamingRpc", + inputType = io.grpc.testing.protobuf.SimpleRequest.class, + outputType = io.grpc.testing.protobuf.SimpleResponse.class, + methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING) public static io.grpc.MethodDescriptor getBidiStreamingRpcMethod() { io.grpc.MethodDescriptor getBidiStreamingRpcMethod;