Skip to content

Commit 7d77f64

Browse files
authored
compiler: remove some of the static imports in codegen (grpc#7751)
Resolves grpc#7741 Some of the static methods in generated code have the same method name but different package name, such `ClientCalls.asyncClientStreamingCall` and `ServerCalls.asyncClientStreamingCall`. It's less readable using static import than using full-qualified method name in-place.
1 parent e5f57ad commit 7d77f64

File tree

53 files changed

+562
-1262
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+562
-1262
lines changed

alts/src/generated/main/grpc/io/grpc/alts/internal/HandshakerServiceGrpc.java

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
package io.grpc.alts.internal;
22

33
import static io.grpc.MethodDescriptor.generateFullMethodName;
4-
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
5-
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
6-
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
7-
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
8-
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
9-
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
10-
import static io.grpc.stub.ClientCalls.futureUnaryCall;
11-
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
12-
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
13-
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
14-
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
15-
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
16-
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
174

185
/**
196
*/
@@ -118,14 +105,14 @@ public static abstract class HandshakerServiceImplBase implements io.grpc.Bindab
118105
*/
119106
public io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerReq> doHandshake(
120107
io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerResp> responseObserver) {
121-
return asyncUnimplementedStreamingCall(getDoHandshakeMethod(), responseObserver);
108+
return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getDoHandshakeMethod(), responseObserver);
122109
}
123110

124111
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
125112
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
126113
.addMethod(
127114
getDoHandshakeMethod(),
128-
asyncBidiStreamingCall(
115+
io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
129116
new MethodHandlers<
130117
io.grpc.alts.internal.HandshakerReq,
131118
io.grpc.alts.internal.HandshakerResp>(
@@ -160,7 +147,7 @@ protected HandshakerServiceStub build(
160147
*/
161148
public io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerReq> doHandshake(
162149
io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerResp> responseObserver) {
163-
return asyncBidiStreamingCall(
150+
return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
164151
getChannel().newCall(getDoHandshakeMethod(), getCallOptions()), responseObserver);
165152
}
166153
}

android-interop-testing/src/generated/debug/grpc/io/grpc/testing/integration/LoadBalancerStatsServiceGrpc.java

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
package io.grpc.testing.integration;
22

33
import static io.grpc.MethodDescriptor.generateFullMethodName;
4-
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
5-
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
6-
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
7-
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
8-
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
9-
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
10-
import static io.grpc.stub.ClientCalls.futureUnaryCall;
11-
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
12-
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
13-
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
14-
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
15-
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
16-
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
174

185
/**
196
* <pre>
@@ -148,7 +135,7 @@ public static abstract class LoadBalancerStatsServiceImplBase implements io.grpc
148135
*/
149136
public void getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request,
150137
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> responseObserver) {
151-
asyncUnimplementedUnaryCall(getGetClientStatsMethod(), responseObserver);
138+
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetClientStatsMethod(), responseObserver);
152139
}
153140

154141
/**
@@ -158,21 +145,21 @@ public void getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStat
158145
*/
159146
public void getClientAccumulatedStats(io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsRequest request,
160147
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsResponse> responseObserver) {
161-
asyncUnimplementedUnaryCall(getGetClientAccumulatedStatsMethod(), responseObserver);
148+
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetClientAccumulatedStatsMethod(), responseObserver);
162149
}
163150

164151
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
165152
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
166153
.addMethod(
167154
getGetClientStatsMethod(),
168-
asyncUnaryCall(
155+
io.grpc.stub.ServerCalls.asyncUnaryCall(
169156
new MethodHandlers<
170157
io.grpc.testing.integration.Messages.LoadBalancerStatsRequest,
171158
io.grpc.testing.integration.Messages.LoadBalancerStatsResponse>(
172159
this, METHODID_GET_CLIENT_STATS)))
173160
.addMethod(
174161
getGetClientAccumulatedStatsMethod(),
175-
asyncUnaryCall(
162+
io.grpc.stub.ServerCalls.asyncUnaryCall(
176163
new MethodHandlers<
177164
io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsRequest,
178165
io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsResponse>(
@@ -205,7 +192,7 @@ protected LoadBalancerStatsServiceStub build(
205192
*/
206193
public void getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request,
207194
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> responseObserver) {
208-
asyncUnaryCall(
195+
io.grpc.stub.ClientCalls.asyncUnaryCall(
209196
getChannel().newCall(getGetClientStatsMethod(), getCallOptions()), request, responseObserver);
210197
}
211198

@@ -216,7 +203,7 @@ public void getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStat
216203
*/
217204
public void getClientAccumulatedStats(io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsRequest request,
218205
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsResponse> responseObserver) {
219-
asyncUnaryCall(
206+
io.grpc.stub.ClientCalls.asyncUnaryCall(
220207
getChannel().newCall(getGetClientAccumulatedStatsMethod(), getCallOptions()), request, responseObserver);
221208
}
222209
}
@@ -244,7 +231,7 @@ protected LoadBalancerStatsServiceBlockingStub build(
244231
* </pre>
245232
*/
246233
public io.grpc.testing.integration.Messages.LoadBalancerStatsResponse getClientStats(io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request) {
247-
return blockingUnaryCall(
234+
return io.grpc.stub.ClientCalls.blockingUnaryCall(
248235
getChannel(), getGetClientStatsMethod(), getCallOptions(), request);
249236
}
250237

@@ -254,7 +241,7 @@ public io.grpc.testing.integration.Messages.LoadBalancerStatsResponse getClientS
254241
* </pre>
255242
*/
256243
public io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsResponse getClientAccumulatedStats(io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsRequest request) {
257-
return blockingUnaryCall(
244+
return io.grpc.stub.ClientCalls.blockingUnaryCall(
258245
getChannel(), getGetClientAccumulatedStatsMethod(), getCallOptions(), request);
259246
}
260247
}
@@ -283,7 +270,7 @@ protected LoadBalancerStatsServiceFutureStub build(
283270
*/
284271
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.LoadBalancerStatsResponse> getClientStats(
285272
io.grpc.testing.integration.Messages.LoadBalancerStatsRequest request) {
286-
return futureUnaryCall(
273+
return io.grpc.stub.ClientCalls.futureUnaryCall(
287274
getChannel().newCall(getGetClientStatsMethod(), getCallOptions()), request);
288275
}
289276

@@ -294,7 +281,7 @@ public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integr
294281
*/
295282
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsResponse> getClientAccumulatedStats(
296283
io.grpc.testing.integration.Messages.LoadBalancerAccumulatedStatsRequest request) {
297-
return futureUnaryCall(
284+
return io.grpc.stub.ClientCalls.futureUnaryCall(
298285
getChannel().newCall(getGetClientAccumulatedStatsMethod(), getCallOptions()), request);
299286
}
300287
}

android-interop-testing/src/generated/debug/grpc/io/grpc/testing/integration/MetricsServiceGrpc.java

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
package io.grpc.testing.integration;
22

33
import static io.grpc.MethodDescriptor.generateFullMethodName;
4-
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
5-
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
6-
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
7-
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
8-
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
9-
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
10-
import static io.grpc.stub.ClientCalls.futureUnaryCall;
11-
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
12-
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
13-
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
14-
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
15-
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
16-
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
174

185
/**
196
*/
@@ -143,7 +130,7 @@ public static abstract class MetricsServiceImplBase implements io.grpc.BindableS
143130
*/
144131
public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
145132
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
146-
asyncUnimplementedUnaryCall(getGetAllGaugesMethod(), responseObserver);
133+
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetAllGaugesMethod(), responseObserver);
147134
}
148135

149136
/**
@@ -153,21 +140,21 @@ public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage reques
153140
*/
154141
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
155142
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
156-
asyncUnimplementedUnaryCall(getGetGaugeMethod(), responseObserver);
143+
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetGaugeMethod(), responseObserver);
157144
}
158145

159146
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
160147
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
161148
.addMethod(
162149
getGetAllGaugesMethod(),
163-
asyncServerStreamingCall(
150+
io.grpc.stub.ServerCalls.asyncServerStreamingCall(
164151
new MethodHandlers<
165152
io.grpc.testing.integration.Metrics.EmptyMessage,
166153
io.grpc.testing.integration.Metrics.GaugeResponse>(
167154
this, METHODID_GET_ALL_GAUGES)))
168155
.addMethod(
169156
getGetGaugeMethod(),
170-
asyncUnaryCall(
157+
io.grpc.stub.ServerCalls.asyncUnaryCall(
171158
new MethodHandlers<
172159
io.grpc.testing.integration.Metrics.GaugeRequest,
173160
io.grpc.testing.integration.Metrics.GaugeResponse>(
@@ -198,7 +185,7 @@ protected MetricsServiceStub build(
198185
*/
199186
public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
200187
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
201-
asyncServerStreamingCall(
188+
io.grpc.stub.ClientCalls.asyncServerStreamingCall(
202189
getChannel().newCall(getGetAllGaugesMethod(), getCallOptions()), request, responseObserver);
203190
}
204191

@@ -209,7 +196,7 @@ public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage reques
209196
*/
210197
public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
211198
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
212-
asyncUnaryCall(
199+
io.grpc.stub.ClientCalls.asyncUnaryCall(
213200
getChannel().newCall(getGetGaugeMethod(), getCallOptions()), request, responseObserver);
214201
}
215202
}
@@ -236,7 +223,7 @@ protected MetricsServiceBlockingStub build(
236223
*/
237224
public java.util.Iterator<io.grpc.testing.integration.Metrics.GaugeResponse> getAllGauges(
238225
io.grpc.testing.integration.Metrics.EmptyMessage request) {
239-
return blockingServerStreamingCall(
226+
return io.grpc.stub.ClientCalls.blockingServerStreamingCall(
240227
getChannel(), getGetAllGaugesMethod(), getCallOptions(), request);
241228
}
242229

@@ -246,7 +233,7 @@ public java.util.Iterator<io.grpc.testing.integration.Metrics.GaugeResponse> get
246233
* </pre>
247234
*/
248235
public io.grpc.testing.integration.Metrics.GaugeResponse getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request) {
249-
return blockingUnaryCall(
236+
return io.grpc.stub.ClientCalls.blockingUnaryCall(
250237
getChannel(), getGetGaugeMethod(), getCallOptions(), request);
251238
}
252239
}
@@ -272,7 +259,7 @@ protected MetricsServiceFutureStub build(
272259
*/
273260
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Metrics.GaugeResponse> getGauge(
274261
io.grpc.testing.integration.Metrics.GaugeRequest request) {
275-
return futureUnaryCall(
262+
return io.grpc.stub.ClientCalls.futureUnaryCall(
276263
getChannel().newCall(getGetGaugeMethod(), getCallOptions()), request);
277264
}
278265
}

android-interop-testing/src/generated/debug/grpc/io/grpc/testing/integration/ReconnectServiceGrpc.java

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
package io.grpc.testing.integration;
22

33
import static io.grpc.MethodDescriptor.generateFullMethodName;
4-
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
5-
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
6-
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
7-
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
8-
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
9-
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
10-
import static io.grpc.stub.ClientCalls.futureUnaryCall;
11-
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
12-
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
13-
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
14-
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
15-
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
16-
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
174

185
/**
196
* <pre>
@@ -145,28 +132,28 @@ public static abstract class ReconnectServiceImplBase implements io.grpc.Bindabl
145132
*/
146133
public void start(io.grpc.testing.integration.EmptyProtos.Empty request,
147134
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
148-
asyncUnimplementedUnaryCall(getStartMethod(), responseObserver);
135+
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getStartMethod(), responseObserver);
149136
}
150137

151138
/**
152139
*/
153140
public void stop(io.grpc.testing.integration.EmptyProtos.Empty request,
154141
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.ReconnectInfo> responseObserver) {
155-
asyncUnimplementedUnaryCall(getStopMethod(), responseObserver);
142+
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getStopMethod(), responseObserver);
156143
}
157144

158145
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
159146
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
160147
.addMethod(
161148
getStartMethod(),
162-
asyncUnaryCall(
149+
io.grpc.stub.ServerCalls.asyncUnaryCall(
163150
new MethodHandlers<
164151
io.grpc.testing.integration.EmptyProtos.Empty,
165152
io.grpc.testing.integration.EmptyProtos.Empty>(
166153
this, METHODID_START)))
167154
.addMethod(
168155
getStopMethod(),
169-
asyncUnaryCall(
156+
io.grpc.stub.ServerCalls.asyncUnaryCall(
170157
new MethodHandlers<
171158
io.grpc.testing.integration.EmptyProtos.Empty,
172159
io.grpc.testing.integration.Messages.ReconnectInfo>(
@@ -196,15 +183,15 @@ protected ReconnectServiceStub build(
196183
*/
197184
public void start(io.grpc.testing.integration.EmptyProtos.Empty request,
198185
io.grpc.stub.StreamObserver<io.grpc.testing.integration.EmptyProtos.Empty> responseObserver) {
199-
asyncUnaryCall(
186+
io.grpc.stub.ClientCalls.asyncUnaryCall(
200187
getChannel().newCall(getStartMethod(), getCallOptions()), request, responseObserver);
201188
}
202189

203190
/**
204191
*/
205192
public void stop(io.grpc.testing.integration.EmptyProtos.Empty request,
206193
io.grpc.stub.StreamObserver<io.grpc.testing.integration.Messages.ReconnectInfo> responseObserver) {
207-
asyncUnaryCall(
194+
io.grpc.stub.ClientCalls.asyncUnaryCall(
208195
getChannel().newCall(getStopMethod(), getCallOptions()), request, responseObserver);
209196
}
210197
}
@@ -229,14 +216,14 @@ protected ReconnectServiceBlockingStub build(
229216
/**
230217
*/
231218
public io.grpc.testing.integration.EmptyProtos.Empty start(io.grpc.testing.integration.EmptyProtos.Empty request) {
232-
return blockingUnaryCall(
219+
return io.grpc.stub.ClientCalls.blockingUnaryCall(
233220
getChannel(), getStartMethod(), getCallOptions(), request);
234221
}
235222

236223
/**
237224
*/
238225
public io.grpc.testing.integration.Messages.ReconnectInfo stop(io.grpc.testing.integration.EmptyProtos.Empty request) {
239-
return blockingUnaryCall(
226+
return io.grpc.stub.ClientCalls.blockingUnaryCall(
240227
getChannel(), getStopMethod(), getCallOptions(), request);
241228
}
242229
}
@@ -262,15 +249,15 @@ protected ReconnectServiceFutureStub build(
262249
*/
263250
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.EmptyProtos.Empty> start(
264251
io.grpc.testing.integration.EmptyProtos.Empty request) {
265-
return futureUnaryCall(
252+
return io.grpc.stub.ClientCalls.futureUnaryCall(
266253
getChannel().newCall(getStartMethod(), getCallOptions()), request);
267254
}
268255

269256
/**
270257
*/
271258
public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Messages.ReconnectInfo> stop(
272259
io.grpc.testing.integration.EmptyProtos.Empty request) {
273-
return futureUnaryCall(
260+
return io.grpc.stub.ClientCalls.futureUnaryCall(
274261
getChannel().newCall(getStopMethod(), getCallOptions()), request);
275262
}
276263
}

0 commit comments

Comments
 (0)