Skip to content
4 changes: 2 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package(default_visibility = ["//visibility:public"])

load(
"//:gapic_generator_java.bzl",
"google_java_format",
"google_java_format_verification",
)

package(default_visibility = ["//visibility:public"])

JAVA_SRCS = [
"//src/main/java/com/google/api/generator:generator_files",
"//src/main/java/com/google/api/generator/engine:engine_files",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,10 @@ private static List<MethodDefinition> createMethodVariants(
List<MethodDefinition> javaMethods = new ArrayList<>();
String methodName = JavaStyle.toLowerCamelCase(method.name());
TypeNode methodInputType = method.inputType();
TypeNode methodOutputType = method.outputType();
TypeNode methodOutputType =
method.isPaged()
? types.get(String.format(PAGED_RESPONSE_TYPE_NAME_PATTERN, method.name()))
: method.outputType();
String methodInputTypeName = methodInputType.reference().name();

Message inputMessage = messageTypes.get(methodInputTypeName);
Expand Down Expand Up @@ -579,11 +582,12 @@ private static List<MethodDefinition> createMethodVariants(
.setVariable(Variable.builder().setName("request").setType(methodInputType).build())
.setIsDecl(true)
.build();

String callableMethodName =
method.isPaged()
? String.format(PAGED_CALLABLE_NAME_PATTERN, methodName)
: String.format(CALLABLE_NAME_PATTERN, methodName);
MethodInvocationExpr methodReturnExpr =
MethodInvocationExpr.builder()
.setMethodName(String.format(CALLABLE_NAME_PATTERN, methodName))
.build();
MethodInvocationExpr.builder().setMethodName(callableMethodName).build();
methodReturnExpr =
MethodInvocationExpr.builder()
.setMethodName("call")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,16 @@ public void generateServiceClasses() {
+ " return stub.chatAgainCallable();\n"
+ " }\n"
+ "\n"
+ " public final PagedExpandResponse pagedExpand(PagedExpandRequest request) {\n"
+ " return pagedExpandCallable().call(request);\n"
+ " public final PagedExpandPagedResponse pagedExpand(PagedExpandRequest request) {\n"
+ " return pagedExpandPagedCallable().call(request);\n"
+ " }\n"
+ "\n"
+ " public final UnaryCallable<PagedExpandRequest, PagedExpandPagedResponse>\n"
+ " pagedExpandPagedCallable() {\n"
+ " return stub.pagedExpandPagedCallable();\n"
+ " }\n"
+ "\n"
+ " public final UnaryCallable<PagedExpandRequest, PagedExpandResponse>"
+ " pagedExpandCallable() {\n"
+ " public final UnaryCallable<PagedExpandRequest, PagedExpandResponse> pagedExpandCallable() {\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wired to me.
Should it looks like

+ "  public final UnaryCallable<PagedExpandRequest, PagedExpandResponse>"
+ " pagedExpandCallable() {\n"```

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's because of the formatting tool, without this change, the unit test fails. :(

+ " return stub.pagedExpandCallable();\n"
+ " }\n"
+ "\n"
Expand Down