diff --git a/core/src/main/java/io/grpc/MethodDescriptor.java b/core/src/main/java/io/grpc/MethodDescriptor.java index e0027dc68d..84ff4b0180 100644 --- a/core/src/main/java/io/grpc/MethodDescriptor.java +++ b/core/src/main/java/io/grpc/MethodDescriptor.java @@ -31,6 +31,8 @@ package io.grpc; +import static com.google.common.base.Preconditions.checkNotNull; + import com.google.common.base.Preconditions; import java.io.InputStream; @@ -197,7 +199,6 @@ public class MethodDescriptor { * @param requestMarshaller the marshaller used to encode and decode requests * @param responseMarshaller the marshaller used to encode and decode responses */ - @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1774") public static MethodDescriptor create( MethodType type, String fullMethodName, Marshaller requestMarshaller, @@ -345,9 +346,10 @@ public class MethodDescriptor { * @param fullServiceName the fully qualified service name that is prefixed with the package name * @param methodName the short method name */ - @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1774") public static String generateFullMethodName(String fullServiceName, String methodName) { - return fullServiceName + "/" + methodName; + return checkNotNull(fullServiceName, "fullServiceName") + + "/" + + checkNotNull(methodName, "methodName"); } /** @@ -355,10 +357,9 @@ public class MethodDescriptor { * {@code null} if the input is malformed, but you cannot rely on it for the validity of the * input. */ - @ExperimentalApi("https://github.com/grpc/grpc-java/issues/1774") @Nullable public static String extractFullServiceName(String fullMethodName) { - int index = fullMethodName.lastIndexOf('/'); + int index = checkNotNull(fullMethodName, "fullMethodName").lastIndexOf('/'); if (index == -1) { return null; }