Repository navigation
feat(generator): add HttpJsonServiceResumableUploadStubClassComposer - #14303
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces the HttpJsonServiceResumableUploadStubClassComposer class and its corresponding unit tests to generate REST stub transport classes for resumable upload methods in Java GAPIC clients. The review feedback identifies two critical compilation and AST construction issues in the newly added composer: a call to a non-existent method setResponseParserExpr instead of getResponseParserExpr on HttpJsonServiceStubClassComposer, and an invalid usage of ThrowExpr.builder() which does not directly support setting the exception type, message, or cause.
| methodMaker | ||
| .apply( | ||
| "setResponseParser", | ||
| HttpJsonServiceStubClassComposer.setResponseParserExpr(protoMethod)) |
There was a problem hiding this comment.
The method in HttpJsonServiceStubClassComposer is named getResponseParserExpr, not setResponseParserExpr. Calling setResponseParserExpr will cause a compilation failure of the generator.
| HttpJsonServiceStubClassComposer.setResponseParserExpr(protoMethod)) | |
| HttpJsonServiceStubClassComposer.getResponseParserExpr(protoMethod)) |
| ThrowExpr.builder() | ||
| .setType( | ||
| TypeNode.withExceptionClazz( | ||
| IllegalStateException.class)) | ||
| .setMessageExpr("Failed to close resource") | ||
| .setCauseExpr(catchExceptionVarExpr) | ||
| .build()))) |
There was a problem hiding this comment.
ThrowExpr.builder() does not support setType, setMessageExpr, or setCauseExpr directly. Instead, you should build a NewObjectExpr representing the IllegalStateException and pass it to setThrowExpr.
ThrowExpr.builder()
.setThrowExpr(
NewObjectExpr.builder()
.setType(
TypeNode.withExceptionClazz(
IllegalStateException.class))
.setArguments(
Arrays.asList(
ValueExpr.withValue(
StringObjectValue.withValue(
"Failed to close resource")),
catchExceptionVarExpr))
.build())
.build())))Add HttpJsonServiceResumableUploadStubClassComposer to generate dedicated REST stub classes (HttpJson[Service]ResumableUploadStub) for services containing resumable upload RPC methods.
8cb5081 to
e8fec50
Compare
3bb9af9 to
1c99669
Compare
e8fec50
into
whowes/showcase-baseline-resumable-upload
|
|



Work in progress, not ready for review