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

Update equals to include typed bag parent #201

Merged
merged 1 commit into from
Nov 11, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ public String toString() {
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Symbol)) {
} else if (!(o instanceof Symbol)) {
return false;
}
Symbol symbol = (Symbol) o;
return Objects.equals(namespace, symbol.namespace)
return super.equals(o)
&& Objects.equals(namespace, symbol.namespace)
&& Objects.equals(namespaceDelimiter, symbol.namespaceDelimiter)
&& Objects.equals(name, symbol.name)
&& getProperties().equals(symbol.getProperties())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ public boolean equals(Object o) {
}

SymbolDependency that = (SymbolDependency) o;
return dependencyType.equals(that.dependencyType)
return super.equals(o)
&& dependencyType.equals(that.dependencyType)
&& packageName.equals(that.packageName)
&& version.equals(that.version);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ public boolean equals(Object o) {
}

SymbolReference that = (SymbolReference) o;
return symbol.equals(that.symbol)
return super.equals(o)
&& symbol.equals(that.symbol)
&& getProperties().equals(that.getProperties())
&& options.equals(that.options)
&& alias.equals(that.alias);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import software.amazon.smithy.utils.MapUtils;

Expand Down Expand Up @@ -97,6 +98,22 @@ public <T> T expectProperty(String name, Class<T> type) {
"Property `%s` is not part of %s, `%s`", name, getClass().getSimpleName(), this)));
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
} else if (!(o instanceof TypedPropertiesBag)) {
return false;
} else {
return properties.equals(((TypedPropertiesBag) o).properties);
}
}

@Override
public int hashCode() {
return Objects.hash(properties);
}

/**
* Builds a SymbolReference.
*/
Expand Down