Skip to content
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

Add Go Synthetic Trait equality methods #423

Merged
merged 1 commit into from
Apr 12, 2023
Merged

Conversation

syall
Copy link
Contributor

@syall syall commented Apr 11, 2023

Issue #, if available:

N/A.

Description of changes:

When using smithy diff or trait comparisons for the Go Synthetic
trait, the following exception is thrown in the createNode()
implementation:

"attempted to serialize runtime only trait"

This is due to inheriting from AbstractTrait's equality methods which
use the ToNode() method which calls the createNode() method.

This change adds an equals() and hashCode() implementation for the
Go Synthetic trait that does not use ToNode() or createNode().

ToNode() cannot be overriden since AbstractTrait's implementation is
marked as final.

Testing:

  1. Running make smithy-clean smithy-build smithy-publish-local smithy-clean succeeded.
  2. Running make generate in aws/aws-sdk-go-v2 produced no diffs.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@syall syall marked this pull request as ready for review April 11, 2023 23:11
@syall syall requested review from a team as code owners April 11, 2023 23:11
@syall syall force-pushed the go-synthetic-equality branch from 90fd9c9 to 4516575 Compare April 11, 2023 23:32
@syall syall force-pushed the go-synthetic-equality branch from 4516575 to 0efd642 Compare April 12, 2023 17:18
When using smithy diff or trait comparisons for the Go `Synthetic`
trait, the following exception is thrown in the `createNode()`
implementation:

```text
"attempted to serialize runtime only trait"
```

This is due to inheriting from `AbstractTrait`'s equality methods which
use the `ToNode()` method which calls the `createNode()` method.

This change adds an `equals()` and `hashCode()` implementation for the
Go `Synthetic` trait that does not use `ToNode()` or `createNode()`.

`ToNode()` cannot be overriden since `AbstractTrait`'s implementation is
marked as `final`.
@syall syall force-pushed the go-synthetic-equality branch from 0efd642 to 1077edc Compare April 12, 2023 17:27
@syall syall merged commit 7f8b3b9 into aws:main Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants