Skip to content

Commit 1cbbbab

Browse files
authored
Fix javadoc to make it build with JDK 17 (#3415)
* Fix javadoc to make it work with JDK17 * Fix build * Skip Javadoc generation for tests profiles and service modules * Fix source * Update buildspec * Fix provide feedback button * Exclude test modules * Fix exclusion * Fix buildspec formatting
1 parent e4f21d4 commit 1cbbbab

File tree

14 files changed

+135
-66
lines changed

14 files changed

+135
-66
lines changed

buildspecs/release-javadoc.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
version: 0.2
2-
2+
env:
3+
variables:
4+
JAVA_HOME: "/usr/lib/jvm/java-17-amazon-corretto/"
35
phases:
46
install:
5-
runtime-versions:
6-
java: "$JAVA_RUNTIME"
7-
87
commands:
8+
- apt-get update; apt-get install -y java-17-amazon-corretto-jdk
9+
- update-alternatives --auto javac
10+
- update-alternatives --auto java
911
- pip install awscli==1.19.34 --upgrade --user
1012

1113
pre_build:
@@ -16,7 +18,7 @@ phases:
1618
commands:
1719
- 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
1820
- mvn install -P quick -T1C
19-
- 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'
21+
- 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'
2022
- RELEASE_VERSION=`mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec`
2123
-
2224
- aws s3 sync target/site/apidocs/ $DOC_PATH/$RELEASE_VERSION/

codegen/src/main/java/software/amazon/awssdk/codegen/model/intermediate/MemberModel.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -480,17 +480,18 @@ public String getDeprecatedSetterDocumentation() {
480480
+ LF;
481481
}
482482

483-
public String getDefaultConsumerFluentSetterDocumentation() {
483+
public String getDefaultConsumerFluentSetterDocumentation(String variableType) {
484484
return (StringUtils.isNotBlank(documentation) ? documentation : defaultSetter().replace("%s", name) + "\n")
485485
+ LF
486486
+ "This is a convenience method that creates an instance of the {@link "
487-
+ variable.getSimpleType()
487+
+ variableType
488488
+ ".Builder} avoiding the need to create one manually via {@link "
489-
+ variable.getSimpleType()
489+
+ variableType
490490
+ "#builder()}.\n"
491491
+ LF
492+
+ "<p>"
492493
+ "When the {@link Consumer} completes, {@link "
493-
+ variable.getSimpleType()
494+
+ variableType
494495
+ ".Builder#build()} is called immediately and its result is passed to {@link #"
495496
+ getFluentGetterMethodName()
496497
+ "("
@@ -500,14 +501,14 @@ public String getDefaultConsumerFluentSetterDocumentation() {
500501
+ "@param "
501502
+ variable.getVariableName()
502503
+ " a consumer that will call methods on {@link "
503-
+ variable.getSimpleType() + ".Builder}"
504+
+ variableType + ".Builder}"
504505
+ LF
505506
+ "@return " + stripHtmlTags(defaultFluentReturn())
506507
+ LF
507508
+ "@see #"
508509
+ getFluentSetterMethodName()
509510
+ "("
510-
+ variable.getSimpleType()
511+
+ variable.getVariableSetterType()
511512
+ ")";
512513
}
513514

codegen/src/main/java/software/amazon/awssdk/codegen/poet/model/ListSetters.java

+7-3
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,17 @@ public List<MethodSpec> fluentDeclarations(TypeName returnType) {
6363
.varargs(true)
6464
.build());
6565

66+
TypeName elementType = listElementType();
67+
6668
if (elementModel().hasBuilder()) {
6769
fluentDeclarations.add(fluentAbstractSetterDeclaration(ParameterSpec.builder(asConsumerBuilderArray(),
6870
fieldName())
6971
.build(), returnType)
70-
.varargs(true)
71-
.addJavadoc("$L", memberModel().getDefaultConsumerFluentSetterDocumentation())
72-
.build());
72+
.varargs(true)
73+
.addJavadoc("$L",
74+
memberModel().getDefaultConsumerFluentSetterDocumentation(
75+
elementType.toString()))
76+
.build());
7377
}
7478

7579
if (enumTypeInListMemberModel() != null) {

codegen/src/main/java/software/amazon/awssdk/codegen/poet/model/NonCollectionSetters.java

+4-3
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,16 @@ private MethodSpec fluentEnumToStringSetter(TypeName returnType) {
150150
}
151151

152152
private MethodSpec fluentConsumerFluentSetter(TypeName returnType) {
153-
ClassName memberClass = poetExtensions.getModelClass(memberModel().getShape().getC2jName());
153+
MemberModel memberModel = memberModel();
154+
ClassName memberClass = poetExtensions.getModelClass(memberModel.getShape().getC2jName());
154155
ClassName builderClass = memberClass.nestedClass("Builder");
155156
return fluentDefaultSetterDeclaration(builderConsumerParam(builderClass), returnType)
156157
.addModifiers(Modifier.DEFAULT)
157158
.addStatement("return $N($T.builder().applyMutation($N).build())",
158-
memberModel().getFluentSetterMethodName(),
159+
memberModel.getFluentSetterMethodName(),
159160
memberClass,
160161
fieldName())
161-
.addJavadoc("$L", memberModel().getDefaultConsumerFluentSetterDocumentation())
162+
.addJavadoc("$L", memberModel.getDefaultConsumerFluentSetterDocumentation(memberModel.getVariable().getSimpleType()))
162163
.build();
163164
}
164165

codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/alltypesrequest.java

+18-6
Original file line numberDiff line numberDiff line change
@@ -1748,16 +1748,21 @@ public interface Builder extends JsonProtocolTestsRequest.Builder, SdkPojo, Copy
17481748
/**
17491749
* Sets the value of the ListOfStructs property for this object.
17501750
*
1751-
* This is a convenience method that creates an instance of the {@link List<SimpleStruct>.Builder} avoiding the
1752-
* need to create one manually via {@link List<SimpleStruct>#builder()}.
1751+
* This is a convenience method that creates an instance of the
1752+
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct.Builder} avoiding the need to
1753+
* create one manually via
1754+
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct#builder()}.
17531755
*
1754-
* When the {@link Consumer} completes, {@link List<SimpleStruct>.Builder#build()} is called immediately and its
1755-
* result is passed to {@link #listOfStructs(List<SimpleStruct>)}.
1756+
* <p>
1757+
* When the {@link Consumer} completes,
1758+
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct.Builder#build()} is called
1759+
* immediately and its result is passed to {@link #listOfStructs(List<SimpleStruct>)}.
17561760
*
17571761
* @param listOfStructs
1758-
* a consumer that will call methods on {@link List<SimpleStruct>.Builder}
1762+
* a consumer that will call methods on
1763+
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct.Builder}
17591764
* @return Returns a reference to this object so that method calls can be chained together.
1760-
* @see #listOfStructs(List<SimpleStruct>)
1765+
* @see #listOfStructs(java.util.Collection<SimpleStruct>)
17611766
*/
17621767
Builder listOfStructs(Consumer<SimpleStruct.Builder>... listOfStructs);
17631768

@@ -1956,6 +1961,7 @@ public interface Builder extends JsonProtocolTestsRequest.Builder, SdkPojo, Copy
19561961
* This is a convenience method that creates an instance of the {@link StructWithTimestamp.Builder} avoiding the
19571962
* need to create one manually via {@link StructWithTimestamp#builder()}.
19581963
*
1964+
* <p>
19591965
* When the {@link Consumer} completes, {@link StructWithTimestamp.Builder#build()} is called immediately and
19601966
* its result is passed to {@link #structWithNestedTimestampMember(StructWithTimestamp)}.
19611967
*
@@ -1993,6 +1999,7 @@ default Builder structWithNestedTimestampMember(Consumer<StructWithTimestamp.Bui
19931999
* This is a convenience method that creates an instance of the {@link StructWithNestedBlobType.Builder}
19942000
* avoiding the need to create one manually via {@link StructWithNestedBlobType#builder()}.
19952001
*
2002+
* <p>
19962003
* When the {@link Consumer} completes, {@link StructWithNestedBlobType.Builder#build()} is called immediately
19972004
* and its result is passed to {@link #structWithNestedBlob(StructWithNestedBlobType)}.
19982005
*
@@ -2047,6 +2054,7 @@ default Builder structWithNestedBlob(Consumer<StructWithNestedBlobType.Builder>
20472054
* This is a convenience method that creates an instance of the {@link RecursiveStructType.Builder} avoiding the
20482055
* need to create one manually via {@link RecursiveStructType#builder()}.
20492056
*
2057+
* <p>
20502058
* When the {@link Consumer} completes, {@link RecursiveStructType.Builder#build()} is called immediately and
20512059
* its result is passed to {@link #recursiveStruct(RecursiveStructType)}.
20522060
*
@@ -2074,6 +2082,7 @@ default Builder recursiveStruct(Consumer<RecursiveStructType.Builder> recursiveS
20742082
* This is a convenience method that creates an instance of the {@link BaseType.Builder} avoiding the need to
20752083
* create one manually via {@link BaseType#builder()}.
20762084
*
2085+
* <p>
20772086
* When the {@link Consumer} completes, {@link BaseType.Builder#build()} is called immediately and its result is
20782087
* passed to {@link #polymorphicTypeWithSubTypes(BaseType)}.
20792088
*
@@ -2101,6 +2110,7 @@ default Builder polymorphicTypeWithSubTypes(Consumer<BaseType.Builder> polymorph
21012110
* This is a convenience method that creates an instance of the {@link SubTypeOne.Builder} avoiding the need to
21022111
* create one manually via {@link SubTypeOne#builder()}.
21032112
*
2113+
* <p>
21042114
* When the {@link Consumer} completes, {@link SubTypeOne.Builder#build()} is called immediately and its result
21052115
* is passed to {@link #polymorphicTypeWithoutSubTypes(SubTypeOne)}.
21062116
*
@@ -2150,6 +2160,7 @@ default Builder polymorphicTypeWithoutSubTypes(Consumer<SubTypeOne.Builder> poly
21502160
* This is a convenience method that creates an instance of the {@link Underscore_Name_Type.Builder} avoiding
21512161
* the need to create one manually via {@link Underscore_Name_Type#builder()}.
21522162
*
2163+
* <p>
21532164
* When the {@link Consumer} completes, {@link Underscore_Name_Type.Builder#build()} is called immediately and
21542165
* its result is passed to {@link #underscore_Name_Type(Underscore_Name_Type)}.
21552166
*
@@ -2186,6 +2197,7 @@ default Builder underscore_Name_Type(Consumer<Underscore_Name_Type.Builder> unde
21862197
* This is a convenience method that creates an instance of the {@link AllTypesUnionStructure.Builder} avoiding
21872198
* the need to create one manually via {@link AllTypesUnionStructure#builder()}.
21882199
*
2200+
* <p>
21892201
* When the {@link Consumer} completes, {@link AllTypesUnionStructure.Builder#build()} is called immediately and
21902202
* its result is passed to {@link #allTypesUnionStructure(AllTypesUnionStructure)}.
21912203
*

codegen/src/test/resources/software/amazon/awssdk/codegen/poet/model/alltypesresponse.java

+18-6
Original file line numberDiff line numberDiff line change
@@ -1747,16 +1747,21 @@ public interface Builder extends JsonProtocolTestsResponse.Builder, SdkPojo, Cop
17471747
/**
17481748
* Sets the value of the ListOfStructs property for this object.
17491749
*
1750-
* This is a convenience method that creates an instance of the {@link List<SimpleStruct>.Builder} avoiding the
1751-
* need to create one manually via {@link List<SimpleStruct>#builder()}.
1750+
* This is a convenience method that creates an instance of the
1751+
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct.Builder} avoiding the need to
1752+
* create one manually via
1753+
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct#builder()}.
17521754
*
1753-
* When the {@link Consumer} completes, {@link List<SimpleStruct>.Builder#build()} is called immediately and its
1754-
* result is passed to {@link #listOfStructs(List<SimpleStruct>)}.
1755+
* <p>
1756+
* When the {@link Consumer} completes,
1757+
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct.Builder#build()} is called
1758+
* immediately and its result is passed to {@link #listOfStructs(List<SimpleStruct>)}.
17551759
*
17561760
* @param listOfStructs
1757-
* a consumer that will call methods on {@link List<SimpleStruct>.Builder}
1761+
* a consumer that will call methods on
1762+
* {@link software.amazon.awssdk.services.jsonprotocoltests.model.SimpleStruct.Builder}
17581763
* @return Returns a reference to this object so that method calls can be chained together.
1759-
* @see #listOfStructs(List<SimpleStruct>)
1764+
* @see #listOfStructs(java.util.Collection<SimpleStruct>)
17601765
*/
17611766
Builder listOfStructs(Consumer<SimpleStruct.Builder>... listOfStructs);
17621767

@@ -1955,6 +1960,7 @@ public interface Builder extends JsonProtocolTestsResponse.Builder, SdkPojo, Cop
19551960
* This is a convenience method that creates an instance of the {@link StructWithTimestamp.Builder} avoiding the
19561961
* need to create one manually via {@link StructWithTimestamp#builder()}.
19571962
*
1963+
* <p>
19581964
* When the {@link Consumer} completes, {@link StructWithTimestamp.Builder#build()} is called immediately and
19591965
* its result is passed to {@link #structWithNestedTimestampMember(StructWithTimestamp)}.
19601966
*
@@ -1992,6 +1998,7 @@ default Builder structWithNestedTimestampMember(Consumer<StructWithTimestamp.Bui
19921998
* This is a convenience method that creates an instance of the {@link StructWithNestedBlobType.Builder}
19931999
* avoiding the need to create one manually via {@link StructWithNestedBlobType#builder()}.
19942000
*
2001+
* <p>
19952002
* When the {@link Consumer} completes, {@link StructWithNestedBlobType.Builder#build()} is called immediately
19962003
* and its result is passed to {@link #structWithNestedBlob(StructWithNestedBlobType)}.
19972004
*
@@ -2046,6 +2053,7 @@ default Builder structWithNestedBlob(Consumer<StructWithNestedBlobType.Builder>
20462053
* This is a convenience method that creates an instance of the {@link RecursiveStructType.Builder} avoiding the
20472054
* need to create one manually via {@link RecursiveStructType#builder()}.
20482055
*
2056+
* <p>
20492057
* When the {@link Consumer} completes, {@link RecursiveStructType.Builder#build()} is called immediately and
20502058
* its result is passed to {@link #recursiveStruct(RecursiveStructType)}.
20512059
*
@@ -2073,6 +2081,7 @@ default Builder recursiveStruct(Consumer<RecursiveStructType.Builder> recursiveS
20732081
* This is a convenience method that creates an instance of the {@link BaseType.Builder} avoiding the need to
20742082
* create one manually via {@link BaseType#builder()}.
20752083
*
2084+
* <p>
20762085
* When the {@link Consumer} completes, {@link BaseType.Builder#build()} is called immediately and its result is
20772086
* passed to {@link #polymorphicTypeWithSubTypes(BaseType)}.
20782087
*
@@ -2100,6 +2109,7 @@ default Builder polymorphicTypeWithSubTypes(Consumer<BaseType.Builder> polymorph
21002109
* This is a convenience method that creates an instance of the {@link SubTypeOne.Builder} avoiding the need to
21012110
* create one manually via {@link SubTypeOne#builder()}.
21022111
*
2112+
* <p>
21032113
* When the {@link Consumer} completes, {@link SubTypeOne.Builder#build()} is called immediately and its result
21042114
* is passed to {@link #polymorphicTypeWithoutSubTypes(SubTypeOne)}.
21052115
*
@@ -2149,6 +2159,7 @@ default Builder polymorphicTypeWithoutSubTypes(Consumer<SubTypeOne.Builder> poly
21492159
* This is a convenience method that creates an instance of the {@link Underscore_Name_Type.Builder} avoiding
21502160
* the need to create one manually via {@link Underscore_Name_Type#builder()}.
21512161
*
2162+
* <p>
21522163
* When the {@link Consumer} completes, {@link Underscore_Name_Type.Builder#build()} is called immediately and
21532164
* its result is passed to {@link #underscore_Name_Type(Underscore_Name_Type)}.
21542165
*
@@ -2185,6 +2196,7 @@ default Builder underscore_Name_Type(Consumer<Underscore_Name_Type.Builder> unde
21852196
* This is a convenience method that creates an instance of the {@link AllTypesUnionStructure.Builder} avoiding
21862197
* the need to create one manually via {@link AllTypesUnionStructure#builder()}.
21872198
*
2199+
* <p>
21882200
* When the {@link Consumer} completes, {@link AllTypesUnionStructure.Builder#build()} is called immediately and
21892201
* its result is passed to {@link #allTypesUnionStructure(AllTypesUnionStructure)}.
21902202
*

0 commit comments

Comments
 (0)