From c73b75e477c4b48f09ddbd3fdc93f5db84852b65 Mon Sep 17 00:00:00 2001 From: Kun Zhang Date: Thu, 9 Jul 2015 10:15:58 -0700 Subject: [PATCH] Change AbstractServiceDescriptor.methods() to Collection. Resolves #573 --- .../main/grpc/io/grpc/testing/TestServiceGrpc.java | 2 +- .../generated/main/grpc/io/grpc/testing/WorkerGrpc.java | 2 +- compiler/src/java_plugin/cpp/java_generator.cpp | 3 ++- compiler/src/test/golden/TestService.java.txt | 2 +- compiler/src/test/golden/TestServiceNano.java.txt | 2 +- .../main/grpc/io/grpc/examples/helloworld/GreeterGrpc.java | 2 +- .../grpc/io/grpc/examples/routeguide/RouteGuideGrpc.java | 2 +- .../grpc/io/grpc/testing/integration/TestServiceGrpc.java | 2 +- .../main/java/io/grpc/stub/AbstractServiceDescriptor.java | 7 +++---- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/benchmarks/src/generated/main/grpc/io/grpc/testing/TestServiceGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/testing/TestServiceGrpc.java index 2ef48159a9..adc89b86c4 100644 --- a/benchmarks/src/generated/main/grpc/io/grpc/testing/TestServiceGrpc.java +++ b/benchmarks/src/generated/main/grpc/io/grpc/testing/TestServiceGrpc.java @@ -79,7 +79,7 @@ public class TestServiceGrpc { } @java.lang.Override - public com.google.common.collect.ImmutableList> methods() { + public java.util.Collection> methods() { return com.google.common.collect.ImmutableList.>of( unaryCall, streamingCall); diff --git a/benchmarks/src/generated/main/grpc/io/grpc/testing/WorkerGrpc.java b/benchmarks/src/generated/main/grpc/io/grpc/testing/WorkerGrpc.java index c7905fe265..daca204d40 100644 --- a/benchmarks/src/generated/main/grpc/io/grpc/testing/WorkerGrpc.java +++ b/benchmarks/src/generated/main/grpc/io/grpc/testing/WorkerGrpc.java @@ -79,7 +79,7 @@ public class WorkerGrpc { } @java.lang.Override - public com.google.common.collect.ImmutableList> methods() { + public java.util.Collection> methods() { return com.google.common.collect.ImmutableList.>of( runTest, runServer); diff --git a/compiler/src/java_plugin/cpp/java_generator.cpp b/compiler/src/java_plugin/cpp/java_generator.cpp index 3d0da66b88..5795157c1d 100644 --- a/compiler/src/java_plugin/cpp/java_generator.cpp +++ b/compiler/src/java_plugin/cpp/java_generator.cpp @@ -204,7 +204,7 @@ static void PrintServiceDescriptor( p->Print( *vars, "@$Override$\n" - "public $ImmutableList$<$MethodDescriptor$> methods() {\n"); + "public $Collection$<$MethodDescriptor$> methods() {\n"); p->Indent(); p->Print( *vars, @@ -674,6 +674,7 @@ void GenerateService(const ServiceDescriptor* service, vars["AbstractServiceDescriptor"] = "io.grpc.stub.AbstractServiceDescriptor"; vars["ImmutableList"] = "com.google.common.collect.ImmutableList"; + vars["Collection"] = "java.util.Collection"; vars["MethodDescriptor"] = "io.grpc.MethodDescriptor"; vars["ProtoUtils"] = "io.grpc.protobuf.ProtoUtils"; vars["NanoUtils"] = "io.grpc.protobuf.nano.NanoUtils"; diff --git a/compiler/src/test/golden/TestService.java.txt b/compiler/src/test/golden/TestService.java.txt index cb3baf61ac..a8b4f47bdb 100644 --- a/compiler/src/test/golden/TestService.java.txt +++ b/compiler/src/test/golden/TestService.java.txt @@ -121,7 +121,7 @@ public class TestServiceGrpc { } @java.lang.Override - public com.google.common.collect.ImmutableList> methods() { + public java.util.Collection> methods() { return com.google.common.collect.ImmutableList.>of( unaryCall, streamingOutputCall, diff --git a/compiler/src/test/golden/TestServiceNano.java.txt b/compiler/src/test/golden/TestServiceNano.java.txt index a75422d83f..114f6714bd 100644 --- a/compiler/src/test/golden/TestServiceNano.java.txt +++ b/compiler/src/test/golden/TestServiceNano.java.txt @@ -183,7 +183,7 @@ public class TestServiceGrpc { } @java.lang.Override - public com.google.common.collect.ImmutableList> methods() { + public java.util.Collection> methods() { return com.google.common.collect.ImmutableList.>of( unaryCall, streamingOutputCall, diff --git a/examples/src/generated/main/grpc/io/grpc/examples/helloworld/GreeterGrpc.java b/examples/src/generated/main/grpc/io/grpc/examples/helloworld/GreeterGrpc.java index 2ec5972eba..d625d4e8fe 100644 --- a/examples/src/generated/main/grpc/io/grpc/examples/helloworld/GreeterGrpc.java +++ b/examples/src/generated/main/grpc/io/grpc/examples/helloworld/GreeterGrpc.java @@ -65,7 +65,7 @@ public class GreeterGrpc { } @java.lang.Override - public com.google.common.collect.ImmutableList> methods() { + public java.util.Collection> methods() { return com.google.common.collect.ImmutableList.>of( sayHello); } diff --git a/examples/src/generated/main/grpc/io/grpc/examples/routeguide/RouteGuideGrpc.java b/examples/src/generated/main/grpc/io/grpc/examples/routeguide/RouteGuideGrpc.java index 0cc9454b3f..5ef8d6e10c 100644 --- a/examples/src/generated/main/grpc/io/grpc/examples/routeguide/RouteGuideGrpc.java +++ b/examples/src/generated/main/grpc/io/grpc/examples/routeguide/RouteGuideGrpc.java @@ -107,7 +107,7 @@ public class RouteGuideGrpc { } @java.lang.Override - public com.google.common.collect.ImmutableList> methods() { + public java.util.Collection> methods() { return com.google.common.collect.ImmutableList.>of( getFeature, listFeatures, 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 cb111740a2..f579b9a87b 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 @@ -135,7 +135,7 @@ public class TestServiceGrpc { } @java.lang.Override - public com.google.common.collect.ImmutableList> methods() { + public java.util.Collection> methods() { return com.google.common.collect.ImmutableList.>of( emptyCall, unaryCall, diff --git a/stub/src/main/java/io/grpc/stub/AbstractServiceDescriptor.java b/stub/src/main/java/io/grpc/stub/AbstractServiceDescriptor.java index 0b21224c9d..99fe34f5d7 100644 --- a/stub/src/main/java/io/grpc/stub/AbstractServiceDescriptor.java +++ b/stub/src/main/java/io/grpc/stub/AbstractServiceDescriptor.java @@ -31,10 +31,9 @@ package io.grpc.stub; -import com.google.common.collect.ImmutableList; - import io.grpc.MethodDescriptor; +import java.util.Collection; import java.util.Map; /** @@ -45,9 +44,9 @@ import java.util.Map; public abstract class AbstractServiceDescriptor> { /** - * Returns the list of operations defined in the stub configuration. + * Returns an immutable collection of methods defined in the stub configuration. */ - public abstract ImmutableList> methods(); + public abstract Collection> methods(); /** * Returns a new stub configuration for the provided method configurations.