Skip to content

Fix javadoc to make it build with JDK 17 #3415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 13, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions buildspecs/release-javadoc.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
version: 0.2

env:
variables:
JAVA_HOME: "/usr/lib/jvm/java-17-amazon-corretto/"
phases:
install:
runtime-versions:
java: "$JAVA_RUNTIME"

commands:
- apt-get update; apt-get install -y java-17-amazon-corretto-jdk
- update-alternatives --auto javac
- update-alternatives --auto java
- pip install awscli==1.19.34 --upgrade --user

pre_build:
Expand All @@ -16,7 +18,7 @@ phases:
commands:
- python ./scripts/doc_crosslinks/generate_cross_link_data.py --apiDefinitionsBasePath ./services/ --apiDefinitionsRelativeFilePath src/main/resources/codegen-resources/service-2.json --templateFilePath ./scripts/doc_crosslinks/crosslink_redirect.html --outputFilePath ./scripts/crosslink_redirect.html
- mvn install -P quick -T1C
- mvn clean install javadoc:aggregate -B -Ppublic-javadoc -Dcheckstyle.skip -Dspotbugs.skip -DskipTests -Ddoclint=none -pl '!:protocol-tests,!:protocol-tests-core,!:codegen-generated-classes-test,!:sdk-benchmarks,!:module-path-tests,!:test-utils,!:http-client-tests,!:tests-coverage-reporting'
- mvn clean install javadoc:aggregate -B -Ppublic-javadoc -Dcheckstyle.skip -Dspotbugs.skip -DskipTests -Ddoclint=none -pl '!:protocol-tests,!:protocol-tests-core,!:codegen-generated-classes-test,!:sdk-benchmarks,!:s3-benchmarks,!:module-path-tests,!:test-utils,!:http-client-tests,!:tests-coverage-reporting,!:sdk-native-image-test'
- RELEASE_VERSION=`mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec`
-
- aws s3 sync target/site/apidocs/ $DOC_PATH/$RELEASE_VERSION/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -480,17 +480,18 @@ public String getDeprecatedSetterDocumentation() {
+ LF;
}

public String getDefaultConsumerFluentSetterDocumentation() {
public String getDefaultConsumerFluentSetterDocumentation(String variableType) {
return (StringUtils.isNotBlank(documentation) ? documentation : defaultSetter().replace("%s", name) + "\n")
+ LF
+ "This is a convenience method that creates an instance of the {@link "
+ variable.getSimpleType()
+ variableType
+ ".Builder} avoiding the need to create one manually via {@link "
+ variable.getSimpleType()
+ variableType
+ "#builder()}.\n"
+ LF
+ "<p>"
+ "When the {@link Consumer} completes, {@link "
+ variable.getSimpleType()
+ variableType
+ ".Builder#build()} is called immediately and its result is passed to {@link #"
+ getFluentGetterMethodName()
+ "("
Expand All @@ -500,14 +501,14 @@ public String getDefaultConsumerFluentSetterDocumentation() {
+ "@param "
+ variable.getVariableName()
+ " a consumer that will call methods on {@link "
+ variable.getSimpleType() + ".Builder}"
+ variableType + ".Builder}"
+ LF
+ "@return " + stripHtmlTags(defaultFluentReturn())
+ LF
+ "@see #"
+ getFluentSetterMethodName()
+ "("
+ variable.getSimpleType()
+ variable.getVariableSetterType()
+ ")";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,17 @@ public List<MethodSpec> fluentDeclarations(TypeName returnType) {
.varargs(true)
.build());

TypeName elementType = listElementType();

if (elementModel().hasBuilder()) {
fluentDeclarations.add(fluentAbstractSetterDeclaration(ParameterSpec.builder(asConsumerBuilderArray(),
fieldName())
.build(), returnType)
.varargs(true)
.addJavadoc("$L", memberModel().getDefaultConsumerFluentSetterDocumentation())
.build());
.varargs(true)
.addJavadoc("$L",
memberModel().getDefaultConsumerFluentSetterDocumentation(
elementType.toString()))
.build());
}

if (enumTypeInListMemberModel() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,16 @@ private MethodSpec fluentEnumToStringSetter(TypeName returnType) {
}

private MethodSpec fluentConsumerFluentSetter(TypeName returnType) {
ClassName memberClass = poetExtensions.getModelClass(memberModel().getShape().getC2jName());
MemberModel memberModel = memberModel();
ClassName memberClass = poetExtensions.getModelClass(memberModel.getShape().getC2jName());
ClassName builderClass = memberClass.nestedClass("Builder");
return fluentDefaultSetterDeclaration(builderConsumerParam(builderClass), returnType)
.addModifiers(Modifier.DEFAULT)
.addStatement("return $N($T.builder().applyMutation($N).build())",
memberModel().getFluentSetterMethodName(),
memberModel.getFluentSetterMethodName(),
memberClass,
fieldName())
.addJavadoc("$L", memberModel().getDefaultConsumerFluentSetterDocumentation())
.addJavadoc("$L", memberModel.getDefaultConsumerFluentSetterDocumentation(memberModel.getVariable().getSimpleType()))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1748,16 +1748,21 @@ public interface Builder extends JsonProtocolTestsRequest.Builder, SdkPojo, Copy
/**
* Sets the value of the ListOfStructs property for this object.
*
* This is a convenience method that creates an instance of the {@link List<SimpleStruct>.Builder} avoiding the
* need to create one manually via {@link List<SimpleStruct>#builder()}.
* This is a convenience method that creates an instance of the
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct.Builder} avoiding the need to
* create one manually via
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct#builder()}.
*
* When the {@link Consumer} completes, {@link List<SimpleStruct>.Builder#build()} is called immediately and its
* result is passed to {@link #listOfStructs(List<SimpleStruct>)}.
* <p>
* When the {@link Consumer} completes,
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct.Builder#build()} is called
* immediately and its result is passed to {@link #listOfStructs(List<SimpleStruct>)}.
*
* @param listOfStructs
* a consumer that will call methods on {@link List<SimpleStruct>.Builder}
* a consumer that will call methods on
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #listOfStructs(List<SimpleStruct>)
* @see #listOfStructs(java.util.Collection<SimpleStruct>)
*/
Builder listOfStructs(Consumer<SimpleStruct.Builder>... listOfStructs);

Expand Down Expand Up @@ -1956,6 +1961,7 @@ public interface Builder extends JsonProtocolTestsRequest.Builder, SdkPojo, Copy
* This is a convenience method that creates an instance of the {@link StructWithTimestamp.Builder} avoiding the
* need to create one manually via {@link StructWithTimestamp#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link StructWithTimestamp.Builder#build()} is called immediately and
* its result is passed to {@link #structWithNestedTimestampMember(StructWithTimestamp)}.
*
Expand Down Expand Up @@ -1993,6 +1999,7 @@ default Builder structWithNestedTimestampMember(Consumer<StructWithTimestamp.Bui
* This is a convenience method that creates an instance of the {@link StructWithNestedBlobType.Builder}
* avoiding the need to create one manually via {@link StructWithNestedBlobType#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link StructWithNestedBlobType.Builder#build()} is called immediately
* and its result is passed to {@link #structWithNestedBlob(StructWithNestedBlobType)}.
*
Expand Down Expand Up @@ -2047,6 +2054,7 @@ default Builder structWithNestedBlob(Consumer<StructWithNestedBlobType.Builder>
* This is a convenience method that creates an instance of the {@link RecursiveStructType.Builder} avoiding the
* need to create one manually via {@link RecursiveStructType#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link RecursiveStructType.Builder#build()} is called immediately and
* its result is passed to {@link #recursiveStruct(RecursiveStructType)}.
*
Expand Down Expand Up @@ -2074,6 +2082,7 @@ default Builder recursiveStruct(Consumer<RecursiveStructType.Builder> recursiveS
* This is a convenience method that creates an instance of the {@link BaseType.Builder} avoiding the need to
* create one manually via {@link BaseType#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link BaseType.Builder#build()} is called immediately and its result is
* passed to {@link #polymorphicTypeWithSubTypes(BaseType)}.
*
Expand Down Expand Up @@ -2101,6 +2110,7 @@ default Builder polymorphicTypeWithSubTypes(Consumer<BaseType.Builder> polymorph
* This is a convenience method that creates an instance of the {@link SubTypeOne.Builder} avoiding the need to
* create one manually via {@link SubTypeOne#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link SubTypeOne.Builder#build()} is called immediately and its result
* is passed to {@link #polymorphicTypeWithoutSubTypes(SubTypeOne)}.
*
Expand Down Expand Up @@ -2150,6 +2160,7 @@ default Builder polymorphicTypeWithoutSubTypes(Consumer<SubTypeOne.Builder> poly
* This is a convenience method that creates an instance of the {@link Underscore_Name_Type.Builder} avoiding
* the need to create one manually via {@link Underscore_Name_Type#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link Underscore_Name_Type.Builder#build()} is called immediately and
* its result is passed to {@link #underscore_Name_Type(Underscore_Name_Type)}.
*
Expand Down Expand Up @@ -2186,6 +2197,7 @@ default Builder underscore_Name_Type(Consumer<Underscore_Name_Type.Builder> unde
* This is a convenience method that creates an instance of the {@link AllTypesUnionStructure.Builder} avoiding
* the need to create one manually via {@link AllTypesUnionStructure#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link AllTypesUnionStructure.Builder#build()} is called immediately and
* its result is passed to {@link #allTypesUnionStructure(AllTypesUnionStructure)}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1747,16 +1747,21 @@ public interface Builder extends JsonProtocolTestsResponse.Builder, SdkPojo, Cop
/**
* Sets the value of the ListOfStructs property for this object.
*
* This is a convenience method that creates an instance of the {@link List<SimpleStruct>.Builder} avoiding the
* need to create one manually via {@link List<SimpleStruct>#builder()}.
* This is a convenience method that creates an instance of the
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct.Builder} avoiding the need to
* create one manually via
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct#builder()}.
*
* When the {@link Consumer} completes, {@link List<SimpleStruct>.Builder#build()} is called immediately and its
* result is passed to {@link #listOfStructs(List<SimpleStruct>)}.
* <p>
* When the {@link Consumer} completes,
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct.Builder#build()} is called
* immediately and its result is passed to {@link #listOfStructs(List<SimpleStruct>)}.
*
* @param listOfStructs
* a consumer that will call methods on {@link List<SimpleStruct>.Builder}
* a consumer that will call methods on
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #listOfStructs(List<SimpleStruct>)
* @see #listOfStructs(java.util.Collection<SimpleStruct>)
*/
Builder listOfStructs(Consumer<SimpleStruct.Builder>... listOfStructs);

Expand Down Expand Up @@ -1955,6 +1960,7 @@ public interface Builder extends JsonProtocolTestsResponse.Builder, SdkPojo, Cop
* This is a convenience method that creates an instance of the {@link StructWithTimestamp.Builder} avoiding the
* need to create one manually via {@link StructWithTimestamp#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link StructWithTimestamp.Builder#build()} is called immediately and
* its result is passed to {@link #structWithNestedTimestampMember(StructWithTimestamp)}.
*
Expand Down Expand Up @@ -1992,6 +1998,7 @@ default Builder structWithNestedTimestampMember(Consumer<StructWithTimestamp.Bui
* This is a convenience method that creates an instance of the {@link StructWithNestedBlobType.Builder}
* avoiding the need to create one manually via {@link StructWithNestedBlobType#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link StructWithNestedBlobType.Builder#build()} is called immediately
* and its result is passed to {@link #structWithNestedBlob(StructWithNestedBlobType)}.
*
Expand Down Expand Up @@ -2046,6 +2053,7 @@ default Builder structWithNestedBlob(Consumer<StructWithNestedBlobType.Builder>
* This is a convenience method that creates an instance of the {@link RecursiveStructType.Builder} avoiding the
* need to create one manually via {@link RecursiveStructType#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link RecursiveStructType.Builder#build()} is called immediately and
* its result is passed to {@link #recursiveStruct(RecursiveStructType)}.
*
Expand Down Expand Up @@ -2073,6 +2081,7 @@ default Builder recursiveStruct(Consumer<RecursiveStructType.Builder> recursiveS
* This is a convenience method that creates an instance of the {@link BaseType.Builder} avoiding the need to
* create one manually via {@link BaseType#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link BaseType.Builder#build()} is called immediately and its result is
* passed to {@link #polymorphicTypeWithSubTypes(BaseType)}.
*
Expand Down Expand Up @@ -2100,6 +2109,7 @@ default Builder polymorphicTypeWithSubTypes(Consumer<BaseType.Builder> polymorph
* This is a convenience method that creates an instance of the {@link SubTypeOne.Builder} avoiding the need to
* create one manually via {@link SubTypeOne#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link SubTypeOne.Builder#build()} is called immediately and its result
* is passed to {@link #polymorphicTypeWithoutSubTypes(SubTypeOne)}.
*
Expand Down Expand Up @@ -2149,6 +2159,7 @@ default Builder polymorphicTypeWithoutSubTypes(Consumer<SubTypeOne.Builder> poly
* This is a convenience method that creates an instance of the {@link Underscore_Name_Type.Builder} avoiding
* the need to create one manually via {@link Underscore_Name_Type#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link Underscore_Name_Type.Builder#build()} is called immediately and
* its result is passed to {@link #underscore_Name_Type(Underscore_Name_Type)}.
*
Expand Down Expand Up @@ -2185,6 +2196,7 @@ default Builder underscore_Name_Type(Consumer<Underscore_Name_Type.Builder> unde
* This is a convenience method that creates an instance of the {@link AllTypesUnionStructure.Builder} avoiding
* the need to create one manually via {@link AllTypesUnionStructure#builder()}.
*
* <p>
* When the {@link Consumer} completes, {@link AllTypesUnionStructure.Builder#build()} is called immediately and
* its result is passed to {@link #allTypesUnionStructure(AllTypesUnionStructure)}.
*
Expand Down
Loading