Skip to content

Commit

Permalink
minor: do not check details if checker suppression is unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
nrmancuso committed Sep 18, 2022
1 parent 6335dd8 commit f631e97
Showing 1 changed file with 38 additions and 2 deletions.
40 changes: 38 additions & 2 deletions .ci/checker-framework.groovy
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import groovy.transform.EqualsAndHashCode
import groovy.transform.Field
import groovy.transform.Immutable
import groovy.util.slurpersupport.GPathResult
Expand Down Expand Up @@ -382,7 +381,6 @@ private static Set<CheckerFrameworkError> setDifference(final Set<CheckerFramewo
/**
* A class to represent the XML {@code checkerFrameworkError} node.
*/
@EqualsAndHashCode(excludes = ["lineNumber", "unstable"])
@Immutable
class CheckerFrameworkError implements Comparable<CheckerFrameworkError> {

Expand Down Expand Up @@ -473,4 +471,42 @@ class CheckerFrameworkError implements Comparable<CheckerFrameworkError> {
return toXmlString
}

@Override
boolean equals(other) {
if (this.is(other)) {
return true
}

if (getClass() != other.class) {
return false
}

CheckerFrameworkError that = (CheckerFrameworkError) other

boolean isEqualExceptDetails = fileName == that.fileName &&
lineContent == that.lineContent &&
message == that.message &&
specifier == that.specifier

if (that.isUnstable()) {
// if suppression details are not stable, we do not check them
return isEqualExceptDetails

}

return isEqualExceptDetails &&
details == that.details
}

@Override
int hashCode() {
int result
result = (fileName != null ? fileName.hashCode() : 0)
result = 31 * result + (specifier != null ? specifier.hashCode() : 0)
result = 31 * result + (message != null ? message.hashCode() : 0)
result = 31 * result + (details != null ? details.hashCode() : 0)
result = 31 * result + (lineContent != null ? lineContent.hashCode() : 0)
result = 31 * result + (unstable ? 1 : 0)
return result
}
}

0 comments on commit f631e97

Please sign in to comment.