Skip to content

Commit 8f5adf8

Browse files
authored
compiler: flip enable_deprecated option to false (grpc#2080)
resolves grpc#1469 externally
1 parent bfd12e4 commit 8f5adf8

File tree

4 files changed

+19
-545
lines changed

4 files changed

+19
-545
lines changed

compiler/src/java_plugin/cpp/java_plugin.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ class JavaGrpcGenerator : public google::protobuf::compiler::CodeGenerator {
3838
java_grpc_generator::ProtoFlavor flavor =
3939
java_grpc_generator::ProtoFlavor::NORMAL;
4040

41-
// TODO(zdapeng): turn the default value to false
42-
bool enable_deprecated = true;
41+
bool enable_deprecated = false;
4342
for (int i = 0; i < options.size(); i++) {
4443
if (options[i].first == "nano") {
4544
flavor = java_grpc_generator::ProtoFlavor::NANO;

compiler/src/test/golden/TestService.java.txt

Lines changed: 6 additions & 181 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,14 @@ public class TestServiceGrpc {
104104
* Test service that supports all call types.
105105
* </pre>
106106
*/
107-
public static abstract class TestServiceImplBase implements io.grpc.BindableService, TestService {
107+
public static abstract class TestServiceImplBase implements io.grpc.BindableService {
108108

109109
/**
110110
* <pre>
111111
* One request followed by one response.
112112
* The server returns the client payload as-is.
113113
* </pre>
114114
*/
115-
@java.lang.Override
116115
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
117116
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
118117
asyncUnimplementedUnaryCall(METHOD_UNARY_CALL, responseObserver);
@@ -124,7 +123,6 @@ public class TestServiceGrpc {
124123
* The server returns the payload with client desired type and sizes.
125124
* </pre>
126125
*/
127-
@java.lang.Override
128126
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
129127
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
130128
asyncUnimplementedUnaryCall(METHOD_STREAMING_OUTPUT_CALL, responseObserver);
@@ -136,7 +134,6 @@ public class TestServiceGrpc {
136134
* The server returns the aggregated size of client payload as the result.
137135
* </pre>
138136
*/
139-
@java.lang.Override
140137
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
141138
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
142139
return asyncUnimplementedStreamingCall(METHOD_STREAMING_INPUT_CALL, responseObserver);
@@ -149,7 +146,6 @@ public class TestServiceGrpc {
149146
* demonstrates the idea of full bidirectionality.
150147
* </pre>
151148
*/
152-
@java.lang.Override
153149
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
154150
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
155151
return asyncUnimplementedStreamingCall(METHOD_FULL_BIDI_CALL, responseObserver);
@@ -163,7 +159,6 @@ public class TestServiceGrpc {
163159
* first request.
164160
* </pre>
165161
*/
166-
@java.lang.Override
167162
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
168163
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
169164
return asyncUnimplementedStreamingCall(METHOD_HALF_BIDI_CALL, responseObserver);
@@ -215,8 +210,7 @@ public class TestServiceGrpc {
215210
* Test service that supports all call types.
216211
* </pre>
217212
*/
218-
public static class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub>
219-
implements TestService {
213+
public static final class TestServiceStub extends io.grpc.stub.AbstractStub<TestServiceStub> {
220214
private TestServiceStub(io.grpc.Channel channel) {
221215
super(channel);
222216
}
@@ -238,7 +232,6 @@ public class TestServiceGrpc {
238232
* The server returns the client payload as-is.
239233
* </pre>
240234
*/
241-
@java.lang.Override
242235
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
243236
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver) {
244237
asyncUnaryCall(
@@ -251,7 +244,6 @@ public class TestServiceGrpc {
251244
* The server returns the payload with client desired type and sizes.
252245
* </pre>
253246
*/
254-
@java.lang.Override
255247
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
256248
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
257249
asyncServerStreamingCall(
@@ -264,7 +256,6 @@ public class TestServiceGrpc {
264256
* The server returns the aggregated size of client payload as the result.
265257
* </pre>
266258
*/
267-
@java.lang.Override
268259
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
269260
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver) {
270261
return asyncClientStreamingCall(
@@ -278,7 +269,6 @@ public class TestServiceGrpc {
278269
* demonstrates the idea of full bidirectionality.
279270
* </pre>
280271
*/
281-
@java.lang.Override
282272
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
283273
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
284274
return asyncBidiStreamingCall(
@@ -293,7 +283,6 @@ public class TestServiceGrpc {
293283
* first request.
294284
* </pre>
295285
*/
296-
@java.lang.Override
297286
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
298287
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver) {
299288
return asyncBidiStreamingCall(
@@ -306,8 +295,7 @@ public class TestServiceGrpc {
306295
* Test service that supports all call types.
307296
* </pre>
308297
*/
309-
public static class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub>
310-
implements TestServiceBlockingClient {
298+
public static final class TestServiceBlockingStub extends io.grpc.stub.AbstractStub<TestServiceBlockingStub> {
311299
private TestServiceBlockingStub(io.grpc.Channel channel) {
312300
super(channel);
313301
}
@@ -329,7 +317,6 @@ public class TestServiceGrpc {
329317
* The server returns the client payload as-is.
330318
* </pre>
331319
*/
332-
@java.lang.Override
333320
public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request) {
334321
return blockingUnaryCall(
335322
getChannel(), METHOD_UNARY_CALL, getCallOptions(), request);
@@ -341,7 +328,6 @@ public class TestServiceGrpc {
341328
* The server returns the payload with client desired type and sizes.
342329
* </pre>
343330
*/
344-
@java.lang.Override
345331
public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
346332
io.grpc.testing.integration.Test.StreamingOutputCallRequest request) {
347333
return blockingServerStreamingCall(
@@ -354,8 +340,7 @@ public class TestServiceGrpc {
354340
* Test service that supports all call types.
355341
* </pre>
356342
*/
357-
public static class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub>
358-
implements TestServiceFutureClient {
343+
public static final class TestServiceFutureStub extends io.grpc.stub.AbstractStub<TestServiceFutureStub> {
359344
private TestServiceFutureStub(io.grpc.Channel channel) {
360345
super(channel);
361346
}
@@ -377,173 +362,13 @@ public class TestServiceGrpc {
377362
* The server returns the client payload as-is.
378363
* </pre>
379364
*/
380-
@java.lang.Override
381365
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
382366
io.grpc.testing.integration.Test.SimpleRequest request) {
383367
return futureUnaryCall(
384368
getChannel().newCall(METHOD_UNARY_CALL, getCallOptions()), request);
385369
}
386370
}
387371

388-
/**
389-
* This will be removed in the next release.
390-
* If your code has been using gRPC-java v0.15.0 or higher already,
391-
* the following changes to your code are suggested:
392-
* <ul>
393-
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
394-
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
395-
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
396-
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
397-
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
398-
* with {@code serverBuilder.addService(serviceImpl)};</li>
399-
* <li> if you are mocking stubs using mockito, please do not mock them.
400-
* See the documentation on testing with gRPC-java;</li>
401-
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
402-
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
403-
* </ul>
404-
*/
405-
@java.lang.Deprecated public static interface TestService {
406-
407-
public void unaryCall(io.grpc.testing.integration.Test.SimpleRequest request,
408-
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.SimpleResponse> responseObserver);
409-
410-
public void streamingOutputCall(io.grpc.testing.integration.Test.StreamingOutputCallRequest request,
411-
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
412-
413-
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallRequest> streamingInputCall(
414-
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingInputCallResponse> responseObserver);
415-
416-
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> fullBidiCall(
417-
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
418-
419-
public io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallRequest> halfBidiCall(
420-
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Test.StreamingOutputCallResponse> responseObserver);
421-
}
422-
423-
/**
424-
* This will be removed in the next release.
425-
* If your code has been using gRPC-java v0.15.0 or higher already,
426-
* the following changes to your code are suggested:
427-
* <ul>
428-
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
429-
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
430-
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
431-
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
432-
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
433-
* with {@code serverBuilder.addService(serviceImpl)};</li>
434-
* <li> if you are mocking stubs using mockito, please do not mock them.
435-
* See the documentation on testing with gRPC-java;</li>
436-
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
437-
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
438-
* </ul>
439-
*/
440-
@java.lang.Deprecated public static interface TestServiceBlockingClient {
441-
442-
public io.grpc.testing.integration.Test.SimpleResponse unaryCall(io.grpc.testing.integration.Test.SimpleRequest request);
443-
444-
public java.util.Iterator<io.grpc.testing.integration.Test.StreamingOutputCallResponse> streamingOutputCall(
445-
io.grpc.testing.integration.Test.StreamingOutputCallRequest request);
446-
}
447-
448-
/**
449-
* This will be removed in the next release.
450-
* If your code has been using gRPC-java v0.15.0 or higher already,
451-
* the following changes to your code are suggested:
452-
* <ul>
453-
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
454-
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
455-
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
456-
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
457-
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
458-
* with {@code serverBuilder.addService(serviceImpl)};</li>
459-
* <li> if you are mocking stubs using mockito, please do not mock them.
460-
* See the documentation on testing with gRPC-java;</li>
461-
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
462-
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
463-
* </ul>
464-
*/
465-
@java.lang.Deprecated public static interface TestServiceFutureClient {
466-
467-
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Test.SimpleResponse> unaryCall(
468-
io.grpc.testing.integration.Test.SimpleRequest request);
469-
}
470-
471-
/**
472-
* This will be removed in the next release.
473-
* If your code has been using gRPC-java v0.15.0 or higher already,
474-
* the following changes to your code are suggested:
475-
* <ul>
476-
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
477-
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
478-
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
479-
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
480-
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
481-
* with {@code serverBuilder.addService(serviceImpl)};</li>
482-
* <li> if you are mocking stubs using mockito, please do not mock them.
483-
* See the documentation on testing with gRPC-java;</li>
484-
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
485-
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
486-
* </ul>
487-
*/
488-
@java.lang.Deprecated public static abstract class AbstractTestService extends TestServiceImplBase {}
489-
490-
/**
491-
* This will be removed in the next release.
492-
* If your code has been using gRPC-java v0.15.0 or higher already,
493-
* the following changes to your code are suggested:
494-
* <ul>
495-
* <li> replace {@code extends/implements TestService} with {@code extends TestServiceImplBase} for server side;</li>
496-
* <li> replace {@code TestService} with {@code TestServiceStub} for client side;</li>
497-
* <li> replace usage of {@code TestService} with {@code TestServiceImplBase};</li>
498-
* <li> replace usage of {@code AbstractTestService} with {@link TestServiceImplBase};</li>
499-
* <li> replace {@code serverBuilder.addService(TestServiceGrpc.bindService(serviceImpl))}
500-
* with {@code serverBuilder.addService(serviceImpl)};</li>
501-
* <li> if you are mocking stubs using mockito, please do not mock them.
502-
* See the documentation on testing with gRPC-java;</li>
503-
* <li> replace {@code TestServiceBlockingClient} with {@link TestServiceBlockingStub};</li>
504-
* <li> replace {@code TestServiceFutureClient} with {@link TestServiceFutureStub}.</li>
505-
* </ul>
506-
*/
507-
@java.lang.Deprecated public static io.grpc.ServerServiceDefinition bindService(final TestService serviceImpl) {
508-
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
509-
.addMethod(
510-
METHOD_UNARY_CALL,
511-
asyncUnaryCall(
512-
new MethodHandlers<
513-
io.grpc.testing.integration.Test.SimpleRequest,
514-
io.grpc.testing.integration.Test.SimpleResponse>(
515-
serviceImpl, METHODID_UNARY_CALL)))
516-
.addMethod(
517-
METHOD_STREAMING_OUTPUT_CALL,
518-
asyncServerStreamingCall(
519-
new MethodHandlers<
520-
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
521-
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
522-
serviceImpl, METHODID_STREAMING_OUTPUT_CALL)))
523-
.addMethod(
524-
METHOD_STREAMING_INPUT_CALL,
525-
asyncClientStreamingCall(
526-
new MethodHandlers<
527-
io.grpc.testing.integration.Test.StreamingInputCallRequest,
528-
io.grpc.testing.integration.Test.StreamingInputCallResponse>(
529-
serviceImpl, METHODID_STREAMING_INPUT_CALL)))
530-
.addMethod(
531-
METHOD_FULL_BIDI_CALL,
532-
asyncBidiStreamingCall(
533-
new MethodHandlers<
534-
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
535-
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
536-
serviceImpl, METHODID_FULL_BIDI_CALL)))
537-
.addMethod(
538-
METHOD_HALF_BIDI_CALL,
539-
asyncBidiStreamingCall(
540-
new MethodHandlers<
541-
io.grpc.testing.integration.Test.StreamingOutputCallRequest,
542-
io.grpc.testing.integration.Test.StreamingOutputCallResponse>(
543-
serviceImpl, METHODID_HALF_BIDI_CALL)))
544-
.build();
545-
}
546-
547372
private static final int METHODID_UNARY_CALL = 0;
548373
private static final int METHODID_STREAMING_OUTPUT_CALL = 1;
549374
private static final int METHODID_STREAMING_INPUT_CALL = 2;
@@ -555,10 +380,10 @@ public class TestServiceGrpc {
555380
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
556381
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
557382
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
558-
private final TestService serviceImpl;
383+
private final TestServiceImplBase serviceImpl;
559384
private final int methodId;
560385

561-
public MethodHandlers(TestService serviceImpl, int methodId) {
386+
public MethodHandlers(TestServiceImplBase serviceImpl, int methodId) {
562387
this.serviceImpl = serviceImpl;
563388
this.methodId = methodId;
564389
}

0 commit comments

Comments
 (0)