diff --git a/src/main/java/com/google/api/generator/engine/ast/AnnotationNode.java b/src/main/java/com/google/api/generator/engine/ast/AnnotationNode.java index e7b9e05d2f..a7c69d8729 100644 --- a/src/main/java/com/google/api/generator/engine/ast/AnnotationNode.java +++ b/src/main/java/com/google/api/generator/engine/ast/AnnotationNode.java @@ -34,7 +34,7 @@ private static TypeNode annotationType(Class clazz) { // TODO(unsupported): Any args that do not consist of a single string. However, this can easily be // extended to enable such support. @Nullable - public abstract String description(); + public abstract Expr descriptionExpr(); @Override public void accept(AstNodeVisitor visitor) { @@ -60,7 +60,13 @@ public static Builder builder() { public abstract static class Builder { public abstract Builder setType(TypeNode type); - public abstract Builder setDescription(String description); + public Builder setDescription(String description) { + return setDescriptionExpr(ValueExpr.withValue(StringObjectValue.withValue(description))); + } + + // This will never be anything other than a ValueExpr-wrapped StringObjectValue because + // this setter is private, and called only by setDescription above. + abstract Builder setDescriptionExpr(Expr descriptionExpr); abstract AnnotationNode autoBuild(); diff --git a/src/main/java/com/google/api/generator/engine/writer/JavaWriterVisitor.java b/src/main/java/com/google/api/generator/engine/writer/JavaWriterVisitor.java index 37df689d00..c3e238a085 100644 --- a/src/main/java/com/google/api/generator/engine/writer/JavaWriterVisitor.java +++ b/src/main/java/com/google/api/generator/engine/writer/JavaWriterVisitor.java @@ -170,8 +170,10 @@ public void visit(ScopeNode scope) { public void visit(AnnotationNode annotation) { buffer.append(AT); annotation.type().accept(this); - if (annotation.description() != null && !annotation.description().isEmpty()) { - buffer.append(String.format("(\"%s\")", annotation.description())); + if (annotation.descriptionExpr() != null) { + leftParen(); + annotation.descriptionExpr().accept(this); + rightParen(); } newline(); } diff --git a/src/main/java/com/google/api/generator/gapic/composer/ServiceStubSettingsClassComposer.java b/src/main/java/com/google/api/generator/gapic/composer/ServiceStubSettingsClassComposer.java index 1eb5c7e714..2b35fcf842 100644 --- a/src/main/java/com/google/api/generator/gapic/composer/ServiceStubSettingsClassComposer.java +++ b/src/main/java/com/google/api/generator/gapic/composer/ServiceStubSettingsClassComposer.java @@ -354,6 +354,7 @@ private static List createPagingStaticAssignExprs( String.format( "No method found for message type %s for method %s among %s", pagedResponseMessageKey, method.name(), messageTypes.keySet())); + Field repeatedPagedResultsField = pagedResponseMessage.findAndUnwrapFirstRepeatedField(); Preconditions.checkNotNull( repeatedPagedResultsField,