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

Fix equal / hashCode inconsistencies around Array #513

Merged
merged 2 commits into from
Mar 23, 2018
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 @@ -39,11 +39,11 @@ public boolean equals(Object obj) {
return false;
} else {
Annotated o = (Annotated)obj;
return baseType().equals(o.baseType()) && java.util.Arrays.deepEquals(annotations(), o.annotations());
return this.baseType().equals(o.baseType()) && java.util.Arrays.deepEquals(this.annotations(), o.annotations());
}
}
public int hashCode() {
return 37 * (37 * (37 * (17 + "xsbti.api.Annotated".hashCode()) + baseType().hashCode()) + annotations().hashCode());
return 37 * (37 * (37 * (17 + "xsbti.api.Annotated".hashCode()) + baseType().hashCode()) + java.util.Arrays.deepHashCode(annotations()));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See hashCode has been changed to java.util.Arrays.deepHashCode.

}
public String toString() {
return "Annotated(" + "baseType: " + baseType() + ", " + "annotations: " + annotations() + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public boolean equals(Object obj) {
return false;
} else {
Annotation o = (Annotation)obj;
return base().equals(o.base()) && java.util.Arrays.deepEquals(arguments(), o.arguments());
return this.base().equals(o.base()) && java.util.Arrays.deepEquals(this.arguments(), o.arguments());
}
}
public int hashCode() {
return 37 * (37 * (37 * (17 + "xsbti.api.Annotation".hashCode()) + base().hashCode()) + arguments().hashCode());
return 37 * (37 * (37 * (17 + "xsbti.api.Annotation".hashCode()) + base().hashCode()) + java.util.Arrays.deepHashCode(arguments()));
}
public String toString() {
return "Annotation(" + "base: " + base() + ", " + "arguments: " + arguments() + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public boolean equals(Object obj) {
return false;
} else {
AnnotationArgument o = (AnnotationArgument)obj;
return name().equals(o.name()) && value().equals(o.value());
return this.name().equals(o.name()) && this.value().equals(o.value());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public boolean equals(Object obj) {
return false;
} else {
ClassDefinition o = (ClassDefinition)obj;
return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations());
return this.name().equals(o.name()) && this.access().equals(o.access()) && this.modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(this.annotations(), o.annotations());
}
}
public int hashCode() {
return 37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.ClassDefinition".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode());
return 37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.ClassDefinition".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + java.util.Arrays.deepHashCode(annotations()));
}
public String toString() {
return "ClassDefinition(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public boolean equals(Object obj) {
return false;
} else {
ClassLikeDef o = (ClassLikeDef)obj;
return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && java.util.Arrays.deepEquals(typeParameters(), o.typeParameters()) && definitionType().equals(o.definitionType());
return this.name().equals(o.name()) && this.access().equals(o.access()) && this.modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(this.annotations(), o.annotations()) && java.util.Arrays.deepEquals(this.typeParameters(), o.typeParameters()) && this.definitionType().equals(o.definitionType());
}
}
public int hashCode() {
return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.ClassLikeDef".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()) + typeParameters().hashCode()) + definitionType().hashCode());
return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.ClassLikeDef".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + java.util.Arrays.deepHashCode(annotations())) + java.util.Arrays.deepHashCode(typeParameters())) + definitionType().hashCode());
}
public String toString() {
return "ClassLikeDef(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ", " + "typeParameters: " + typeParameters() + ", " + "definitionType: " + definitionType() + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public boolean equals(Object obj) {
return false;
} else {
Companions o = (Companions)obj;
return classApi().equals(o.classApi()) && objectApi().equals(o.objectApi());
return this.classApi().equals(o.classApi()) && this.objectApi().equals(o.objectApi());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public boolean equals(Object obj) {
return false;
} else {
Constant o = (Constant)obj;
return baseType().equals(o.baseType()) && value().equals(o.value());
return this.baseType().equals(o.baseType()) && this.value().equals(o.value());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ public boolean equals(Object obj) {
return false;
} else {
Def o = (Def)obj;
return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && java.util.Arrays.deepEquals(typeParameters(), o.typeParameters()) && java.util.Arrays.deepEquals(valueParameters(), o.valueParameters()) && returnType().equals(o.returnType());
return this.name().equals(o.name()) && this.access().equals(o.access()) && this.modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(this.annotations(), o.annotations()) && java.util.Arrays.deepEquals(this.typeParameters(), o.typeParameters()) && java.util.Arrays.deepEquals(this.valueParameters(), o.valueParameters()) && this.returnType().equals(o.returnType());
}
}
public int hashCode() {
return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.Def".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()) + typeParameters().hashCode()) + valueParameters().hashCode()) + returnType().hashCode());
return 37 * (37 * (37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.Def".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + java.util.Arrays.deepHashCode(annotations())) + java.util.Arrays.deepHashCode(typeParameters())) + java.util.Arrays.deepHashCode(valueParameters())) + returnType().hashCode());
}
public String toString() {
return "Def(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ", " + "typeParameters: " + typeParameters() + ", " + "valueParameters: " + valueParameters() + ", " + "returnType: " + returnType() + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ public boolean equals(Object obj) {
return false;
} else {
Definition o = (Definition)obj;
return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations());
return this.name().equals(o.name()) && this.access().equals(o.access()) && this.modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(this.annotations(), o.annotations());
}
}
public int hashCode() {
return 37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.Definition".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode());
return 37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.Definition".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + java.util.Arrays.deepHashCode(annotations()));
}
public String toString() {
return "Definition(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public boolean equals(Object obj) {
return false;
} else {
Existential o = (Existential)obj;
return baseType().equals(o.baseType()) && java.util.Arrays.deepEquals(clause(), o.clause());
return this.baseType().equals(o.baseType()) && java.util.Arrays.deepEquals(this.clause(), o.clause());
}
}
public int hashCode() {
return 37 * (37 * (37 * (17 + "xsbti.api.Existential".hashCode()) + baseType().hashCode()) + clause().hashCode());
return 37 * (37 * (37 * (17 + "xsbti.api.Existential".hashCode()) + baseType().hashCode()) + java.util.Arrays.deepHashCode(clause()));
}
public String toString() {
return "Existential(" + "baseType: " + baseType() + ", " + "clause: " + clause() + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public boolean equals(Object obj) {
return false;
} else {
ExternalDependency o = (ExternalDependency)obj;
return sourceClassName().equals(o.sourceClassName()) && targetProductClassName().equals(o.targetProductClassName()) && targetClass().equals(o.targetClass()) && context().equals(o.context());
return this.sourceClassName().equals(o.sourceClassName()) && this.targetProductClassName().equals(o.targetProductClassName()) && this.targetClass().equals(o.targetClass()) && this.context().equals(o.context());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public boolean equals(Object obj) {
return false;
} else {
FieldLike o = (FieldLike)obj;
return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && tpe().equals(o.tpe());
return this.name().equals(o.name()) && this.access().equals(o.access()) && this.modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(this.annotations(), o.annotations()) && this.tpe().equals(o.tpe());
}
}
public int hashCode() {
return 37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.FieldLike".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()) + tpe().hashCode());
return 37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.FieldLike".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + java.util.Arrays.deepHashCode(annotations())) + tpe().hashCode());
}
public String toString() {
return "FieldLike(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ", " + "tpe: " + tpe() + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public boolean equals(Object obj) {
return false;
} else {
Id o = (Id)obj;
return id().equals(o.id());
return this.id().equals(o.id());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public boolean equals(Object obj) {
return false;
} else {
IdQualifier o = (IdQualifier)obj;
return value().equals(o.value());
return this.value().equals(o.value());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public boolean equals(Object obj) {
return false;
} else {
InternalDependency o = (InternalDependency)obj;
return sourceClassName().equals(o.sourceClassName()) && targetClassName().equals(o.targetClassName()) && context().equals(o.context());
return this.sourceClassName().equals(o.sourceClassName()) && this.targetClassName().equals(o.targetClassName()) && this.context().equals(o.context());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public boolean equals(Object obj) {
return false;
} else {
MethodParameter o = (MethodParameter)obj;
return name().equals(o.name()) && tpe().equals(o.tpe()) && (hasDefault() == o.hasDefault()) && modifier().equals(o.modifier());
return this.name().equals(o.name()) && this.tpe().equals(o.tpe()) && (this.hasDefault() == o.hasDefault()) && this.modifier().equals(o.modifier());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public boolean equals(Object obj) {
return false;
} else {
NameHash o = (NameHash)obj;
return name().equals(o.name()) && scope().equals(o.scope()) && (hash() == o.hash());
return this.name().equals(o.name()) && this.scope().equals(o.scope()) && (this.hash() == o.hash());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public boolean equals(Object obj) {
return false;
} else {
Package o = (Package)obj;
return name().equals(o.name());
return this.name().equals(o.name());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public boolean equals(Object obj) {
return false;
} else {
ParameterList o = (ParameterList)obj;
return java.util.Arrays.deepEquals(parameters(), o.parameters()) && (isImplicit() == o.isImplicit());
return java.util.Arrays.deepEquals(this.parameters(), o.parameters()) && (this.isImplicit() == o.isImplicit());
}
}
public int hashCode() {
return 37 * (37 * (37 * (17 + "xsbti.api.ParameterList".hashCode()) + parameters().hashCode()) + (new Boolean(isImplicit())).hashCode());
return 37 * (37 * (37 * (17 + "xsbti.api.ParameterList".hashCode()) + java.util.Arrays.deepHashCode(parameters())) + (new Boolean(isImplicit())).hashCode());
}
public String toString() {
return "ParameterList(" + "parameters: " + parameters() + ", " + "isImplicit: " + isImplicit() + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public boolean equals(Object obj) {
return false;
} else {
ParameterRef o = (ParameterRef)obj;
return id().equals(o.id());
return this.id().equals(o.id());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public boolean equals(Object obj) {
return false;
} else {
Parameterized o = (Parameterized)obj;
return baseType().equals(o.baseType()) && java.util.Arrays.deepEquals(typeArguments(), o.typeArguments());
return this.baseType().equals(o.baseType()) && java.util.Arrays.deepEquals(this.typeArguments(), o.typeArguments());
}
}
public int hashCode() {
return 37 * (37 * (37 * (17 + "xsbti.api.Parameterized".hashCode()) + baseType().hashCode()) + typeArguments().hashCode());
return 37 * (37 * (37 * (17 + "xsbti.api.Parameterized".hashCode()) + baseType().hashCode()) + java.util.Arrays.deepHashCode(typeArguments()));
}
public String toString() {
return "Parameterized(" + "baseType: " + baseType() + ", " + "typeArguments: " + typeArguments() + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public boolean equals(Object obj) {
return false;
} else {
ParameterizedDefinition o = (ParameterizedDefinition)obj;
return name().equals(o.name()) && access().equals(o.access()) && modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(annotations(), o.annotations()) && java.util.Arrays.deepEquals(typeParameters(), o.typeParameters());
return this.name().equals(o.name()) && this.access().equals(o.access()) && this.modifiers().equals(o.modifiers()) && java.util.Arrays.deepEquals(this.annotations(), o.annotations()) && java.util.Arrays.deepEquals(this.typeParameters(), o.typeParameters());
}
}
public int hashCode() {
return 37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.ParameterizedDefinition".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + annotations().hashCode()) + typeParameters().hashCode());
return 37 * (37 * (37 * (37 * (37 * (37 * (17 + "xsbti.api.ParameterizedDefinition".hashCode()) + name().hashCode()) + access().hashCode()) + modifiers().hashCode()) + java.util.Arrays.deepHashCode(annotations())) + java.util.Arrays.deepHashCode(typeParameters()));
}
public String toString() {
return "ParameterizedDefinition(" + "name: " + name() + ", " + "access: " + access() + ", " + "modifiers: " + modifiers() + ", " + "annotations: " + annotations() + ", " + "typeParameters: " + typeParameters() + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ public boolean equals(Object obj) {
return false;
} else {
Path o = (Path)obj;
return java.util.Arrays.deepEquals(components(), o.components());
return java.util.Arrays.deepEquals(this.components(), o.components());
}
}
public int hashCode() {
return 37 * (37 * (17 + "xsbti.api.Path".hashCode()) + components().hashCode());
return 37 * (37 * (17 + "xsbti.api.Path".hashCode()) + java.util.Arrays.deepHashCode(components()));
}
public String toString() {
return "Path(" + "components: " + components() + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ public boolean equals(Object obj) {
return false;
} else {
Polymorphic o = (Polymorphic)obj;
return baseType().equals(o.baseType()) && java.util.Arrays.deepEquals(parameters(), o.parameters());
return this.baseType().equals(o.baseType()) && java.util.Arrays.deepEquals(this.parameters(), o.parameters());
}
}
public int hashCode() {
return 37 * (37 * (37 * (17 + "xsbti.api.Polymorphic".hashCode()) + baseType().hashCode()) + parameters().hashCode());
return 37 * (37 * (37 * (17 + "xsbti.api.Polymorphic".hashCode()) + baseType().hashCode()) + java.util.Arrays.deepHashCode(parameters()));
}
public String toString() {
return "Polymorphic(" + "baseType: " + baseType() + ", " + "parameters: " + parameters() + ")";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public boolean equals(Object obj) {
return false;
} else {
Private o = (Private)obj;
return qualifier().equals(o.qualifier());
return this.qualifier().equals(o.qualifier());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public boolean equals(Object obj) {
return false;
} else {
Projection o = (Projection)obj;
return prefix().equals(o.prefix()) && id().equals(o.id());
return this.prefix().equals(o.prefix()) && this.id().equals(o.id());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public boolean equals(Object obj) {
return false;
} else {
Protected o = (Protected)obj;
return qualifier().equals(o.qualifier());
return this.qualifier().equals(o.qualifier());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public boolean equals(Object obj) {
return false;
} else {
Qualified o = (Qualified)obj;
return qualifier().equals(o.qualifier());
return this.qualifier().equals(o.qualifier());
}
}
public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public boolean equals(Object obj) {
return false;
} else {
Singleton o = (Singleton)obj;
return path().equals(o.path());
return this.path().equals(o.path());
}
}
public int hashCode() {
Expand Down
Loading