Skip to content

Commit

Permalink
Improve equals code generation.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Sep 11, 2024
1 parent 5d0eace commit d65f9e0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/main/java/edu/hm/hafner/util/FilteredLog.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ public void merge(final FilteredLog other) {
}

@Override
@Generated
public boolean equals(final Object o) {
if (this == o) {
return true;
Expand All @@ -275,12 +276,12 @@ public boolean equals(final Object o) {
&& lines == that.lines
&& Objects.equals(title, that.title)
&& Objects.equals(infoMessages, that.infoMessages)
&& Objects.equals(errorMessages, that.errorMessages)
&& Objects.equals(lock, that.lock);
&& Objects.equals(errorMessages, that.errorMessages);
}

@Override
@Generated
public int hashCode() {
return Objects.hash(title, maxLines, lines, infoMessages, errorMessages, lock);
return Objects.hash(title, maxLines, lines, infoMessages, errorMessages);
}
}
5 changes: 4 additions & 1 deletion src/main/java/edu/hm/hafner/util/LineRange.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public boolean isSingleLine() {
}

@Override
@Generated
public boolean equals(final Object o) {
if (this == o) {
return true;
Expand All @@ -109,10 +110,12 @@ public boolean equals(final Object o) {
return false;
}
var lineRange = (LineRange) o;
return start == lineRange.start && end == lineRange.end;
return start == lineRange.start
&& end == lineRange.end;
}

@Override
@Generated
public int hashCode() {
return Objects.hash(start, end);
}
Expand Down

0 comments on commit d65f9e0

Please sign in to comment.