mirror of https://github.com/grpc/grpc-java.git
compiler: allow capitalized java keywords as rpc names (#4309)
previously `Import` fails because it gets turned into a method named `import`. This PR makes the method be named `import_`, everything else stays the same, such as the name in the method descriptor. Note: `iMport` or `iMPORT` or any variation of capitalizations that is not `Import` always worked. `Import` gets translated into `import` because of our attempts to camel case the names.
This commit is contained in:
parent
ecab86fad9
commit
8d3d26dda1
|
|
@ -4,6 +4,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <google/protobuf/compiler/java/java_names.h>
|
#include <google/protobuf/compiler/java/java_names.h>
|
||||||
#include <google/protobuf/descriptor.h>
|
#include <google/protobuf/descriptor.h>
|
||||||
|
|
@ -33,9 +34,67 @@ using google::protobuf::io::Printer;
|
||||||
using google::protobuf::SourceLocation;
|
using google::protobuf::SourceLocation;
|
||||||
using std::to_string;
|
using std::to_string;
|
||||||
|
|
||||||
|
// java keywords from: https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.9
|
||||||
|
static std::set<string> java_keywords = {
|
||||||
|
"abstract",
|
||||||
|
"assert",
|
||||||
|
"boolean",
|
||||||
|
"break",
|
||||||
|
"byte",
|
||||||
|
"case",
|
||||||
|
"catch",
|
||||||
|
"char",
|
||||||
|
"class",
|
||||||
|
"const",
|
||||||
|
"continue",
|
||||||
|
"default",
|
||||||
|
"do",
|
||||||
|
"double",
|
||||||
|
"else",
|
||||||
|
"enum",
|
||||||
|
"extends",
|
||||||
|
"final",
|
||||||
|
"finally",
|
||||||
|
"float",
|
||||||
|
"for",
|
||||||
|
"goto",
|
||||||
|
"if",
|
||||||
|
"implements",
|
||||||
|
"import",
|
||||||
|
"instanceof",
|
||||||
|
"int",
|
||||||
|
"interface",
|
||||||
|
"long",
|
||||||
|
"native",
|
||||||
|
"new",
|
||||||
|
"package",
|
||||||
|
"private",
|
||||||
|
"protected",
|
||||||
|
"public",
|
||||||
|
"return",
|
||||||
|
"short",
|
||||||
|
"static",
|
||||||
|
"strictfp",
|
||||||
|
"super",
|
||||||
|
"switch",
|
||||||
|
"synchronized",
|
||||||
|
"this",
|
||||||
|
"throw",
|
||||||
|
"throws",
|
||||||
|
"transient",
|
||||||
|
"try",
|
||||||
|
"void",
|
||||||
|
"volatile",
|
||||||
|
"while",
|
||||||
|
// additional ones added by us
|
||||||
|
"true",
|
||||||
|
"false",
|
||||||
|
};
|
||||||
|
|
||||||
// Adjust a method name prefix identifier to follow the JavaBean spec:
|
// Adjust a method name prefix identifier to follow the JavaBean spec:
|
||||||
// - decapitalize the first letter
|
// - decapitalize the first letter
|
||||||
// - remove embedded underscores & capitalize the following letter
|
// - remove embedded underscores & capitalize the following letter
|
||||||
|
// Finally, if the result is a reserved java keyword, append an underscore.
|
||||||
static string MixedLower(const string& word) {
|
static string MixedLower(const string& word) {
|
||||||
string w;
|
string w;
|
||||||
w += tolower(word[0]);
|
w += tolower(word[0]);
|
||||||
|
|
@ -48,6 +107,9 @@ static string MixedLower(const string& word) {
|
||||||
after_underscore = false;
|
after_underscore = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (java_keywords.find(w) != java_keywords.end()) {
|
||||||
|
return w + "_";
|
||||||
|
}
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,43 @@ public final class TestServiceGrpc {
|
||||||
}
|
}
|
||||||
return getHalfBidiCallMethod;
|
return getHalfBidiCallMethod;
|
||||||
}
|
}
|
||||||
|
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||||
|
@java.lang.Deprecated // Use {@link #getImportMethod()} instead.
|
||||||
|
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_IMPORT = getImportMethodHelper();
|
||||||
|
|
||||||
|
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallResponse> getImportMethod;
|
||||||
|
|
||||||
|
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||||
|
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallResponse> getImportMethod() {
|
||||||
|
return getImportMethodHelper();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallResponse> getImportMethodHelper() {
|
||||||
|
io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest, io.grpc.testing.integration.Test.StreamingInputCallResponse> getImportMethod;
|
||||||
|
if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
|
||||||
|
synchronized (TestServiceGrpc.class) {
|
||||||
|
if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
|
||||||
|
TestServiceGrpc.getImportMethod = getImportMethod =
|
||||||
|
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingInputCallRequest, io.grpc.testing.integration.Test.StreamingInputCallResponse>newBuilder()
|
||||||
|
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
||||||
|
.setFullMethodName(generateFullMethodName(
|
||||||
|
"grpc.testing.TestService", "Import"))
|
||||||
|
.setSampledToLocalTracing(true)
|
||||||
|
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallRequest.getDefaultInstance()))
|
||||||
|
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallResponse.getDefaultInstance()))
|
||||||
|
.setSchemaDescriptor(new TestServiceMethodDescriptorSupplier("Import"))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getImportMethod;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new async stub that supports all call types for the service
|
* Creates a new async stub that supports all call types for the service
|
||||||
|
|
@ -304,6 +341,17 @@ public final class TestServiceGrpc {
|
||||||
return asyncUnimplementedStreamingCall(getHalfBidiCallMethodHelper(), responseObserver);
|
return asyncUnimplementedStreamingCall(getHalfBidiCallMethodHelper(), responseObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* An RPC method whose Java name collides with a keyword, and whose generated
|
||||||
|
* method should have a '_' appended.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> import_(
|
||||||
|
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
|
||||||
|
return asyncUnimplementedStreamingCall(getImportMethodHelper(), responseObserver);
|
||||||
|
}
|
||||||
|
|
||||||
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
|
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
|
||||||
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
|
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
|
||||||
.addMethod(
|
.addMethod(
|
||||||
|
|
@ -341,6 +389,13 @@ public final class TestServiceGrpc {
|
||||||
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
|
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
|
||||||
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
|
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
|
||||||
this, METHODID_HALF_BIDI_CALL)))
|
this, METHODID_HALF_BIDI_CALL)))
|
||||||
|
.addMethod(
|
||||||
|
getImportMethodHelper(),
|
||||||
|
asyncBidiStreamingCall(
|
||||||
|
new MethodHandlers<
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallResponse>(
|
||||||
|
this, METHODID_IMPORT)))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -428,6 +483,18 @@ public final class TestServiceGrpc {
|
||||||
return asyncBidiStreamingCall(
|
return asyncBidiStreamingCall(
|
||||||
getChannel().newCall(getHalfBidiCallMethodHelper(), getCallOptions()), responseObserver);
|
getChannel().newCall(getHalfBidiCallMethodHelper(), getCallOptions()), responseObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* An RPC method whose Java name collides with a keyword, and whose generated
|
||||||
|
* method should have a '_' appended.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> import_(
|
||||||
|
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
|
||||||
|
return asyncBidiStreamingCall(
|
||||||
|
getChannel().newCall(getImportMethodHelper(), getCallOptions()), responseObserver);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -514,6 +581,7 @@ public final class TestServiceGrpc {
|
||||||
private static final int METHODID_STREAMING_INPUT_CALL = 2;
|
private static final int METHODID_STREAMING_INPUT_CALL = 2;
|
||||||
private static final int METHODID_FULL_BIDI_CALL = 3;
|
private static final int METHODID_FULL_BIDI_CALL = 3;
|
||||||
private static final int METHODID_HALF_BIDI_CALL = 4;
|
private static final int METHODID_HALF_BIDI_CALL = 4;
|
||||||
|
private static final int METHODID_IMPORT = 5;
|
||||||
|
|
||||||
private static final class MethodHandlers<Req, Resp> implements
|
private static final class MethodHandlers<Req, Resp> implements
|
||||||
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
||||||
|
|
@ -559,6 +627,9 @@ public final class TestServiceGrpc {
|
||||||
case METHODID_HALF_BIDI_CALL:
|
case METHODID_HALF_BIDI_CALL:
|
||||||
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
|
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
|
||||||
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
|
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
|
||||||
|
case METHODID_IMPORT:
|
||||||
|
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.import_(
|
||||||
|
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse>) responseObserver);
|
||||||
default:
|
default:
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
@ -615,6 +686,7 @@ public final class TestServiceGrpc {
|
||||||
.addMethod(getStreamingInputCallMethodHelper())
|
.addMethod(getStreamingInputCallMethodHelper())
|
||||||
.addMethod(getFullBidiCallMethodHelper())
|
.addMethod(getFullBidiCallMethodHelper())
|
||||||
.addMethod(getHalfBidiCallMethodHelper())
|
.addMethod(getHalfBidiCallMethodHelper())
|
||||||
|
.addMethod(getImportMethodHelper())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,4 +51,8 @@ service TestService {
|
||||||
// first request.
|
// first request.
|
||||||
rpc HalfBidiCall(stream StreamingOutputCallRequest)
|
rpc HalfBidiCall(stream StreamingOutputCallRequest)
|
||||||
returns (stream StreamingOutputCallResponse);
|
returns (stream StreamingOutputCallResponse);
|
||||||
|
|
||||||
|
// An RPC method whose Java name collides with a keyword, and whose generated
|
||||||
|
// method should have a '_' appended.
|
||||||
|
rpc Import(stream StreamingInputCallRequest) returns (stream StreamingInputCallResponse);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -210,6 +210,42 @@ public final class TestServiceGrpc {
|
||||||
}
|
}
|
||||||
return getHalfBidiCallMethod;
|
return getHalfBidiCallMethod;
|
||||||
}
|
}
|
||||||
|
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||||
|
@java.lang.Deprecated // Use {@link #getImportMethod()} instead.
|
||||||
|
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallResponse> METHOD_IMPORT = getImportMethodHelper();
|
||||||
|
|
||||||
|
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallResponse> getImportMethod;
|
||||||
|
|
||||||
|
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||||
|
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallResponse> getImportMethod() {
|
||||||
|
return getImportMethodHelper();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallResponse> getImportMethodHelper() {
|
||||||
|
io.grpc.MethodDescriptor<io.grpc.testing.integration.Test.StreamingInputCallRequest, io.grpc.testing.integration.Test.StreamingInputCallResponse> getImportMethod;
|
||||||
|
if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
|
||||||
|
synchronized (TestServiceGrpc.class) {
|
||||||
|
if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
|
||||||
|
TestServiceGrpc.getImportMethod = getImportMethod =
|
||||||
|
io.grpc.MethodDescriptor.<io.grpc.testing.integration.Test.StreamingInputCallRequest, io.grpc.testing.integration.Test.StreamingInputCallResponse>newBuilder()
|
||||||
|
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
||||||
|
.setFullMethodName(generateFullMethodName(
|
||||||
|
"grpc.testing.TestService", "Import"))
|
||||||
|
.setSampledToLocalTracing(true)
|
||||||
|
.setRequestMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallRequest.getDefaultInstance()))
|
||||||
|
.setResponseMarshaller(io.grpc.protobuf.lite.ProtoLiteUtils.marshaller(
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallResponse.getDefaultInstance()))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getImportMethod;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new async stub that supports all call types for the service
|
* Creates a new async stub that supports all call types for the service
|
||||||
|
|
@ -299,6 +335,17 @@ public final class TestServiceGrpc {
|
||||||
return asyncUnimplementedStreamingCall(getHalfBidiCallMethodHelper(), responseObserver);
|
return asyncUnimplementedStreamingCall(getHalfBidiCallMethodHelper(), responseObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* An RPC method whose Java name collides with a keyword, and whose generated
|
||||||
|
* method should have a '_' appended.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> import_(
|
||||||
|
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
|
||||||
|
return asyncUnimplementedStreamingCall(getImportMethodHelper(), responseObserver);
|
||||||
|
}
|
||||||
|
|
||||||
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
|
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
|
||||||
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
|
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
|
||||||
.addMethod(
|
.addMethod(
|
||||||
|
|
@ -336,6 +383,13 @@ public final class TestServiceGrpc {
|
||||||
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
|
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
|
||||||
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
|
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
|
||||||
this, METHODID_HALF_BIDI_CALL)))
|
this, METHODID_HALF_BIDI_CALL)))
|
||||||
|
.addMethod(
|
||||||
|
getImportMethodHelper(),
|
||||||
|
asyncBidiStreamingCall(
|
||||||
|
new MethodHandlers<
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.Test.StreamingInputCallResponse>(
|
||||||
|
this, METHODID_IMPORT)))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -423,6 +477,18 @@ public final class TestServiceGrpc {
|
||||||
return asyncBidiStreamingCall(
|
return asyncBidiStreamingCall(
|
||||||
getChannel().newCall(getHalfBidiCallMethodHelper(), getCallOptions()), responseObserver);
|
getChannel().newCall(getHalfBidiCallMethodHelper(), getCallOptions()), responseObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* An RPC method whose Java name collides with a keyword, and whose generated
|
||||||
|
* method should have a '_' appended.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> import_(
|
||||||
|
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
|
||||||
|
return asyncBidiStreamingCall(
|
||||||
|
getChannel().newCall(getImportMethodHelper(), getCallOptions()), responseObserver);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -509,6 +575,7 @@ public final class TestServiceGrpc {
|
||||||
private static final int METHODID_STREAMING_INPUT_CALL = 2;
|
private static final int METHODID_STREAMING_INPUT_CALL = 2;
|
||||||
private static final int METHODID_FULL_BIDI_CALL = 3;
|
private static final int METHODID_FULL_BIDI_CALL = 3;
|
||||||
private static final int METHODID_HALF_BIDI_CALL = 4;
|
private static final int METHODID_HALF_BIDI_CALL = 4;
|
||||||
|
private static final int METHODID_IMPORT = 5;
|
||||||
|
|
||||||
private static final class MethodHandlers<Req, Resp> implements
|
private static final class MethodHandlers<Req, Resp> implements
|
||||||
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
||||||
|
|
@ -554,6 +621,9 @@ public final class TestServiceGrpc {
|
||||||
case METHODID_HALF_BIDI_CALL:
|
case METHODID_HALF_BIDI_CALL:
|
||||||
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
|
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
|
||||||
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
|
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse>) responseObserver);
|
||||||
|
case METHODID_IMPORT:
|
||||||
|
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.import_(
|
||||||
|
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse>) responseObserver);
|
||||||
default:
|
default:
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
@ -574,6 +644,7 @@ public final class TestServiceGrpc {
|
||||||
.addMethod(getStreamingInputCallMethodHelper())
|
.addMethod(getStreamingInputCallMethodHelper())
|
||||||
.addMethod(getFullBidiCallMethodHelper())
|
.addMethod(getFullBidiCallMethodHelper())
|
||||||
.addMethod(getHalfBidiCallMethodHelper())
|
.addMethod(getHalfBidiCallMethodHelper())
|
||||||
|
.addMethod(getImportMethodHelper())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -222,6 +222,44 @@ public final class TestServiceGrpc {
|
||||||
}
|
}
|
||||||
return getHalfBidiCallMethod;
|
return getHalfBidiCallMethod;
|
||||||
}
|
}
|
||||||
|
private static final int ARG_IN_METHOD_IMPORT = 10;
|
||||||
|
private static final int ARG_OUT_METHOD_IMPORT = 11;
|
||||||
|
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||||
|
@java.lang.Deprecated // Use {@link #getImportMethod()} instead.
|
||||||
|
public static final io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> METHOD_IMPORT = getImportMethodHelper();
|
||||||
|
|
||||||
|
private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> getImportMethod;
|
||||||
|
|
||||||
|
@io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
|
||||||
|
public static io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> getImportMethod() {
|
||||||
|
return getImportMethodHelper();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> getImportMethodHelper() {
|
||||||
|
io.grpc.MethodDescriptor<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest, io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> getImportMethod;
|
||||||
|
if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
|
||||||
|
synchronized (TestServiceGrpc.class) {
|
||||||
|
if ((getImportMethod = TestServiceGrpc.getImportMethod) == null) {
|
||||||
|
TestServiceGrpc.getImportMethod = getImportMethod =
|
||||||
|
io.grpc.MethodDescriptor.<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest, io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>newBuilder()
|
||||||
|
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
||||||
|
.setFullMethodName(generateFullMethodName(
|
||||||
|
"grpc.testing.TestService", "Import"))
|
||||||
|
.setSampledToLocalTracing(true)
|
||||||
|
.setRequestMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>marshaller(
|
||||||
|
new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest>(ARG_IN_METHOD_IMPORT)))
|
||||||
|
.setResponseMarshaller(io.grpc.protobuf.nano.NanoUtils.<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>marshaller(
|
||||||
|
new NanoFactory<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(ARG_OUT_METHOD_IMPORT)))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getImportMethod;
|
||||||
|
}
|
||||||
|
|
||||||
private static final class NanoFactory<T extends com.google.protobuf.nano.MessageNano>
|
private static final class NanoFactory<T extends com.google.protobuf.nano.MessageNano>
|
||||||
implements io.grpc.protobuf.nano.MessageNanoFactory<T> {
|
implements io.grpc.protobuf.nano.MessageNanoFactory<T> {
|
||||||
|
|
@ -265,6 +303,12 @@ public final class TestServiceGrpc {
|
||||||
case ARG_OUT_METHOD_HALF_BIDI_CALL:
|
case ARG_OUT_METHOD_HALF_BIDI_CALL:
|
||||||
o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
|
o = new io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse();
|
||||||
break;
|
break;
|
||||||
|
case ARG_IN_METHOD_IMPORT:
|
||||||
|
o = new io.grpc.testing.integration.nano.Test.StreamingInputCallRequest();
|
||||||
|
break;
|
||||||
|
case ARG_OUT_METHOD_IMPORT:
|
||||||
|
o = new io.grpc.testing.integration.nano.Test.StreamingInputCallResponse();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
@ -362,6 +406,17 @@ public final class TestServiceGrpc {
|
||||||
return asyncUnimplementedStreamingCall(getHalfBidiCallMethodHelper(), responseObserver);
|
return asyncUnimplementedStreamingCall(getHalfBidiCallMethodHelper(), responseObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* An RPC method whose Java name collides with a keyword, and whose generated
|
||||||
|
* method should have a '_' appended.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> import_(
|
||||||
|
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
|
||||||
|
return asyncUnimplementedStreamingCall(getImportMethodHelper(), responseObserver);
|
||||||
|
}
|
||||||
|
|
||||||
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
|
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
|
||||||
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
|
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
|
||||||
.addMethod(
|
.addMethod(
|
||||||
|
|
@ -399,6 +454,13 @@ public final class TestServiceGrpc {
|
||||||
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
|
io.grpc.testing.integration.nano.Test.StreamingOutputCallRequest,
|
||||||
io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
|
io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>(
|
||||||
this, METHODID_HALF_BIDI_CALL)))
|
this, METHODID_HALF_BIDI_CALL)))
|
||||||
|
.addMethod(
|
||||||
|
getImportMethodHelper(),
|
||||||
|
asyncBidiStreamingCall(
|
||||||
|
new MethodHandlers<
|
||||||
|
io.grpc.testing.integration.nano.Test.StreamingInputCallRequest,
|
||||||
|
io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>(
|
||||||
|
this, METHODID_IMPORT)))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -486,6 +548,18 @@ public final class TestServiceGrpc {
|
||||||
return asyncBidiStreamingCall(
|
return asyncBidiStreamingCall(
|
||||||
getChannel().newCall(getHalfBidiCallMethodHelper(), getCallOptions()), responseObserver);
|
getChannel().newCall(getHalfBidiCallMethodHelper(), getCallOptions()), responseObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* An RPC method whose Java name collides with a keyword, and whose generated
|
||||||
|
* method should have a '_' appended.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallRequest> import_(
|
||||||
|
io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse> responseObserver) {
|
||||||
|
return asyncBidiStreamingCall(
|
||||||
|
getChannel().newCall(getImportMethodHelper(), getCallOptions()), responseObserver);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -572,6 +646,7 @@ public final class TestServiceGrpc {
|
||||||
private static final int METHODID_STREAMING_INPUT_CALL = 2;
|
private static final int METHODID_STREAMING_INPUT_CALL = 2;
|
||||||
private static final int METHODID_FULL_BIDI_CALL = 3;
|
private static final int METHODID_FULL_BIDI_CALL = 3;
|
||||||
private static final int METHODID_HALF_BIDI_CALL = 4;
|
private static final int METHODID_HALF_BIDI_CALL = 4;
|
||||||
|
private static final int METHODID_IMPORT = 5;
|
||||||
|
|
||||||
private static final class MethodHandlers<Req, Resp> implements
|
private static final class MethodHandlers<Req, Resp> implements
|
||||||
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
||||||
|
|
@ -617,6 +692,9 @@ public final class TestServiceGrpc {
|
||||||
case METHODID_HALF_BIDI_CALL:
|
case METHODID_HALF_BIDI_CALL:
|
||||||
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
|
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.halfBidiCall(
|
||||||
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
|
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingOutputCallResponse>) responseObserver);
|
||||||
|
case METHODID_IMPORT:
|
||||||
|
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.import_(
|
||||||
|
(io.grpc.stub.StreamObserver<io.grpc.testing.integration.nano.Test.StreamingInputCallResponse>) responseObserver);
|
||||||
default:
|
default:
|
||||||
throw new AssertionError();
|
throw new AssertionError();
|
||||||
}
|
}
|
||||||
|
|
@ -637,6 +715,7 @@ public final class TestServiceGrpc {
|
||||||
.addMethod(getStreamingInputCallMethodHelper())
|
.addMethod(getStreamingInputCallMethodHelper())
|
||||||
.addMethod(getFullBidiCallMethodHelper())
|
.addMethod(getFullBidiCallMethodHelper())
|
||||||
.addMethod(getHalfBidiCallMethodHelper())
|
.addMethod(getHalfBidiCallMethodHelper())
|
||||||
|
.addMethod(getImportMethodHelper())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue