Skip to content

Commit

Permalink
Do not included cached values in hashcode and equals
Browse files Browse the repository at this point in the history
  • Loading branch information
mpkorstanje committed Oct 17, 2024
1 parent 2c49146 commit e9e1ade
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ public boolean equals(Object o) {
}
ClasspathResourceSelector that = (ClasspathResourceSelector) o;
return Objects.equals(this.classpathResourceName, that.classpathResourceName)
&& Objects.equals(this.position, that.position)
&& Objects.equals(this.classpathResources, that.classpathResources);
&& Objects.equals(this.position, that.position);
}

/**
Expand All @@ -140,13 +139,17 @@ public boolean equals(Object o) {
@API(status = STABLE, since = "1.3")
@Override
public int hashCode() {
return Objects.hash(this.classpathResourceName, this.position, this.classpathResources);
return Objects.hash(this.classpathResourceName, this.position);
}

@Override
public String toString() {
return new ToStringBuilder(this).append("classpathResourceName", this.classpathResourceName).append("position",
this.position).toString();
// @formatter:off
return new ToStringBuilder(this)
.append("classpathResourceName", this.classpathResourceName)
.append("position", this.position)
.toString();
// @formatter:on
}

@Override
Expand Down

0 comments on commit e9e1ade

Please sign in to comment.