Skip to content

Commit fc1d7fb

Browse files
Merge pull request #562 from aws/staging/243eacae-cefc-4c16-b05c-d861f4f751b8
Pull request: release <- staging/243eacae-cefc-4c16-b05c-d861f4f751b8
2 parents 438eaf6 + 25b08cb commit fc1d7fb

File tree

285 files changed

+1441
-696
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

285 files changed

+1441
-696
lines changed

.changes/2.7.5.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"version": "2.7.5",
3+
"date": "2019-07-12",
4+
"entries": [
5+
{
6+
"type": "feature",
7+
"category": "AWS SDK for Java v2",
8+
"description": "Introduce a new method `equalsBySdkFields` to compare only non-inherited fields for model classes."
9+
},
10+
{
11+
"type": "feature",
12+
"category": "AWS RoboMaker",
13+
"description": "Added Melodic as a supported Robot Software Suite Version"
14+
},
15+
{
16+
"type": "feature",
17+
"category": "AmazonApiGatewayV2",
18+
"description": "Bug fix (Add tags field to Update Stage , Api and DomainName Responses )"
19+
},
20+
{
21+
"type": "bugfix",
22+
"category": "AWS SDK for Java v2",
23+
"description": "Fix the bug where `equals` and `hashCode` methods in the AWS service request and response classes were not calling super."
24+
},
25+
{
26+
"type": "feature",
27+
"category": "AWS Identity and Access Management",
28+
"description": "Removed exception that was indicated but never thrown for IAM GetAccessKeyLastUsed API"
29+
},
30+
{
31+
"type": "bugfix",
32+
"category": "AWS SDK for Java v2",
33+
"description": "Fix `AwsSessionCredentials#equals` to not compare super because the super is an interface."
34+
},
35+
{
36+
"type": "feature",
37+
"category": "Amazon Elasticsearch Service",
38+
"description": "Amazon Elasticsearch Service now supports M5, C5, and R5 instance types."
39+
}
40+
]
41+
}

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# __2.7.5__ __2019-07-12__
2+
## __AWS Identity and Access Management__
3+
- ### Features
4+
- Removed exception that was indicated but never thrown for IAM GetAccessKeyLastUsed API
5+
6+
## __AWS RoboMaker__
7+
- ### Features
8+
- Added Melodic as a supported Robot Software Suite Version
9+
10+
## __AWS SDK for Java v2__
11+
- ### Features
12+
- Introduce a new method `equalsBySdkFields` to compare only non-inherited fields for model classes.
13+
14+
- ### Bugfixes
15+
- Fix `AwsSessionCredentials#equals` to not compare super because the super is an interface.
16+
- Fix the bug where `equals` and `hashCode` methods in the AWS service request and response classes were not calling super.
17+
18+
## __Amazon Elasticsearch Service__
19+
- ### Features
20+
- Amazon Elasticsearch Service now supports M5, C5, and R5 instance types.
21+
22+
## __AmazonApiGatewayV2__
23+
- ### Features
24+
- Bug fix (Add tags field to Update Stage , Api and DomainName Responses )
25+
126
# __2.7.4__ __2019-07-11__
227
## __Amazon CloudWatch Events__
328
- ### Features

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ You can import the whole SDK into your project (includes all services) as follow
4646
<dependency>
4747
<groupId>software.amazon.awssdk</groupId>
4848
<artifactId>aws-sdk-java</artifactId>
49-
<version>2.7.4</version>
49+
<version>2.7.5</version>
5050
</dependency>
5151
```
5252

@@ -58,12 +58,12 @@ Alternatively you can add dependencies for the specific services you use only:
5858
<dependency>
5959
<groupId>software.amazon.awssdk</groupId>
6060
<artifactId>ec2</artifactId>
61-
<version>2.7.4</version>
61+
<version>2.7.5</version>
6262
</dependency>
6363
<dependency>
6464
<groupId>software.amazon.awssdk</groupId>
6565
<artifactId>s3</artifactId>
66-
<version>2.7.4</version>
66+
<version>2.7.5</version>
6767
</dependency>
6868
```
6969

@@ -77,7 +77,7 @@ To automatically manage module versions (currently all modules have the same ver
7777
<dependency>
7878
<groupId>software.amazon.awssdk</groupId>
7979
<artifactId>bom</artifactId>
80-
<version>2.7.4</version>
80+
<version>2.7.5</version>
8181
<type>pom</type>
8282
<scope>import</scope>
8383
</dependency>

aws-sdk-java/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>software.amazon.awssdk</groupId>
66
<artifactId>aws-sdk-java-pom</artifactId>
7-
<version>2.7.4</version>
7+
<version>2.7.5</version>
88
<relativePath>../pom.xml</relativePath>
99
</parent>
1010
<artifactId>aws-sdk-java</artifactId>

bom-internal/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>aws-sdk-java-pom</artifactId>
77
<groupId>software.amazon.awssdk</groupId>
8-
<version>2.7.4</version>
8+
<version>2.7.5</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>software.amazon.awssdk</groupId>
66
<artifactId>aws-sdk-java-pom</artifactId>
7-
<version>2.7.4</version>
7+
<version>2.7.5</version>
88
<relativePath>../pom.xml</relativePath>
99
</parent>
1010
<artifactId>bom</artifactId>

bundle/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>software.amazon.awssdk</groupId>
2323
<artifactId>aws-sdk-java-pom</artifactId>
24-
<version>2.7.4</version>
24+
<version>2.7.5</version>
2525
</parent>
2626
<artifactId>bundle</artifactId>
2727
<packaging>jar</packaging>

codegen-lite-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>software.amazon.awssdk</groupId>
99
<artifactId>aws-sdk-java-pom</artifactId>
10-
<version>2.7.4</version>
10+
<version>2.7.5</version>
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313
<artifactId>codegen-lite-maven-plugin</artifactId>

codegen-lite/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>software.amazon.awssdk</groupId>
88
<artifactId>aws-sdk-java-pom</artifactId>
9-
<version>2.7.4</version>
9+
<version>2.7.5</version>
1010
</parent>
1111
<artifactId>codegen-lite</artifactId>
1212
<name>AWS Java SDK :: Code Generator Lite</name>

codegen-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<parent>
2323
<groupId>software.amazon.awssdk</groupId>
2424
<artifactId>aws-sdk-java-pom</artifactId>
25-
<version>2.7.4</version>
25+
<version>2.7.5</version>
2626
<relativePath>../pom.xml</relativePath>
2727
</parent>
2828
<artifactId>codegen-maven-plugin</artifactId>

codegen/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<parent>
2222
<groupId>software.amazon.awssdk</groupId>
2323
<artifactId>aws-sdk-java-pom</artifactId>
24-
<version>2.7.4</version>
24+
<version>2.7.5</version>
2525
</parent>
2626
<artifactId>codegen</artifactId>
2727
<name>AWS Java SDK :: Code Generator</name>

codegen/src/main/java/software/amazon/awssdk/codegen/poet/PoetExtensions.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel;
2121
import software.amazon.awssdk.codegen.model.intermediate.OperationModel;
2222
import software.amazon.awssdk.codegen.model.intermediate.ShapeModel;
23+
import software.amazon.awssdk.codegen.model.intermediate.ShapeType;
2324

2425
/**
2526
* Extension and convenience methods to Poet that use the intermediate model.
@@ -144,4 +145,12 @@ public ClassName eventStreamResponseHandlerVisitorBuilderType(OperationModel ope
144145
public ClassName getModelClassFromShape(ShapeModel shapeModel) {
145146
return getModelClass(shapeModel.getShapeName());
146147
}
148+
149+
public boolean isResponse(ShapeModel shapeModel) {
150+
return shapeModel.getShapeType() == ShapeType.Response;
151+
}
152+
153+
public boolean isRequest(ShapeModel shapeModel) {
154+
return shapeModel.getShapeType() == ShapeType.Request;
155+
}
147156
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ private List<MethodSpec> modelClassMethods() {
327327
methodSpecs.add(serializableBuilderClass());
328328
methodSpecs.add(modelMethodOverrides.hashCodeMethod(shapeModel));
329329
methodSpecs.add(modelMethodOverrides.equalsMethod(shapeModel));
330+
methodSpecs.add(modelMethodOverrides.equalsBySdkFieldsMethod(shapeModel));
330331
methodSpecs.add(modelMethodOverrides.toStringMethod(shapeModel));
331332
methodSpecs.add(getValueForField());
332333
break;

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public ModelMethodOverrides(PoetExtensions poetExtensions) {
3737
this.poetExtensions = poetExtensions;
3838
}
3939

40-
public MethodSpec equalsMethod(ShapeModel shapeModel) {
40+
public MethodSpec equalsBySdkFieldsMethod(ShapeModel shapeModel) {
4141
ClassName className = poetExtensions.getModelClass(shapeModel.getShapeName());
42-
MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("equals")
42+
MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("equalsBySdkFields")
4343
.returns(boolean.class)
4444
.addAnnotation(Override.class)
4545
.addModifiers(Modifier.PUBLIC)
@@ -77,6 +77,25 @@ public MethodSpec equalsMethod(ShapeModel shapeModel) {
7777
return methodBuilder.addCode(memberEqualsStmt.build()).build();
7878
}
7979

80+
public MethodSpec equalsMethod(ShapeModel shapeModel) {
81+
MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("equals")
82+
.returns(boolean.class)
83+
.addAnnotation(Override.class)
84+
.addModifiers(Modifier.PUBLIC)
85+
.addParameter(Object.class, "obj");
86+
87+
88+
CodeBlock.Builder memberEqualsStmt = CodeBlock.builder();
89+
memberEqualsStmt.add("return ");
90+
91+
if (poetExtensions.isRequest(shapeModel) || poetExtensions.isResponse(shapeModel)) {
92+
memberEqualsStmt.add("super.equals(obj) && ");
93+
}
94+
95+
memberEqualsStmt.add("equalsBySdkFields(obj);");
96+
return methodBuilder.addCode(memberEqualsStmt.build()).build();
97+
}
98+
8099
public MethodSpec toStringMethod(ShapeModel shapeModel) {
81100
String javadoc = "Returns a string representation of this object. This is useful for testing and " +
82101
"debugging. Sensitive data will be redacted from this string using a placeholder " +
@@ -115,6 +134,11 @@ public MethodSpec hashCodeMethod(ShapeModel shapeModel) {
115134
.addModifiers(Modifier.PUBLIC)
116135
.addStatement("int hashCode = 1");
117136

137+
138+
if (poetExtensions.isRequest(shapeModel) || poetExtensions.isResponse(shapeModel)) {
139+
methodBuilder.addStatement("hashCode = 31 * hashCode + super.hashCode()");
140+
}
141+
118142
shapeModel.getNonStreamingMembers()
119143
.forEach(m -> methodBuilder.addStatement(
120144
"hashCode = 31 * hashCode + $T.hashCode($N())",

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,7 @@ public static Class<? extends Builder> serializableBuilderClass() {
920920
@Override
921921
public int hashCode() {
922922
int hashCode = 1;
923+
hashCode = 31 * hashCode + super.hashCode();
923924
hashCode = 31 * hashCode + Objects.hashCode(stringMember());
924925
hashCode = 31 * hashCode + Objects.hashCode(integerMember());
925926
hashCode = 31 * hashCode + Objects.hashCode(booleanMember());
@@ -955,6 +956,11 @@ public int hashCode() {
955956

956957
@Override
957958
public boolean equals(Object obj) {
959+
return super.equals(obj) && equalsBySdkFields(obj);
960+
}
961+
962+
@Override
963+
public boolean equalsBySdkFields(Object obj) {
958964
if (this == obj) {
959965
return true;
960966
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,7 @@ public static Class<? extends Builder> serializableBuilderClass() {
919919
@Override
920920
public int hashCode() {
921921
int hashCode = 1;
922+
hashCode = 31 * hashCode + super.hashCode();
922923
hashCode = 31 * hashCode + Objects.hashCode(stringMember());
923924
hashCode = 31 * hashCode + Objects.hashCode(integerMember());
924925
hashCode = 31 * hashCode + Objects.hashCode(booleanMember());
@@ -954,6 +955,11 @@ public int hashCode() {
954955

955956
@Override
956957
public boolean equals(Object obj) {
958+
return super.equals(obj) && equalsBySdkFields(obj);
959+
}
960+
961+
@Override
962+
public boolean equalsBySdkFields(Object obj) {
957963
if (this == obj) {
958964
return true;
959965
}

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
@Generated("software.amazon.awssdk:codegen")
2424
public final class BaseType implements SdkPojo, Serializable, ToCopyableBuilder<BaseType.Builder, BaseType> {
2525
private static final SdkField<String> BASE_MEMBER_FIELD = SdkField.<String> builder(MarshallingType.STRING)
26-
.getter(getter(BaseType::baseMember)).setter(setter(Builder::baseMember))
27-
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BaseMember").build()).build();
26+
.getter(getter(BaseType::baseMember)).setter(setter(Builder::baseMember))
27+
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("BaseMember").build()).build();
2828

2929
private static final List<SdkField<?>> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(BASE_MEMBER_FIELD));
3030

@@ -38,7 +38,7 @@ private BaseType(BuilderImpl builder) {
3838

3939
/**
4040
* Returns the value of the BaseMember property for this object.
41-
*
41+
*
4242
* @return The value of the BaseMember property for this object.
4343
*/
4444
public String baseMember() {
@@ -67,6 +67,11 @@ public int hashCode() {
6767

6868
@Override
6969
public boolean equals(Object obj) {
70+
return equalsBySdkFields(obj);
71+
}
72+
73+
@Override
74+
public boolean equalsBySdkFields(Object obj) {
7075
if (this == obj) {
7176
return true;
7277
}
@@ -91,10 +96,10 @@ public String toString() {
9196

9297
public <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) {
9398
switch (fieldName) {
94-
case "BaseMember":
95-
return Optional.ofNullable(clazz.cast(baseMember()));
96-
default:
97-
return Optional.empty();
99+
case "BaseMember":
100+
return Optional.ofNullable(clazz.cast(baseMember()));
101+
default:
102+
return Optional.empty();
98103
}
99104
}
100105

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
@Generated("software.amazon.awssdk:codegen")
1616
public final class EmptyModeledException extends JsonProtocolTestsException implements
17-
ToCopyableBuilder<EmptyModeledException.Builder, EmptyModeledException> {
17+
ToCopyableBuilder<EmptyModeledException.Builder, EmptyModeledException> {
1818
private static final List<SdkField<?>> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList());
1919

2020
private static final long serialVersionUID = 1L;
@@ -107,4 +107,3 @@ public List<SdkField<?>> sdkFields() {
107107
}
108108
}
109109
}
110-

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ public int hashCode() {
3838

3939
@Override
4040
public boolean equals(Object obj) {
41+
return equalsBySdkFields(obj);
42+
}
43+
44+
@Override
45+
public boolean equalsBySdkFields(Object obj) {
4146
if (this == obj) {
4247
return true;
4348
}
@@ -68,4 +73,3 @@ public List<SdkField<?>> sdkFields() {
6873
return SDK_FIELDS;
6974
}
7075
}
71-

0 commit comments

Comments
 (0)