From 150cc1941940e7e3f9ca42383c5b6163c932338e Mon Sep 17 00:00:00 2001 From: nimakarimipour Date: Thu, 3 Oct 2024 14:27:59 -0500 Subject: [PATCH] undo rename --- .../core/checkers/nullaway/NullAwayError.java | 6 +++-- .../cs/riple/core/registries/index/Error.java | 27 ++++++++++--------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/annotator-core/src/main/java/edu/ucr/cs/riple/core/checkers/nullaway/NullAwayError.java b/annotator-core/src/main/java/edu/ucr/cs/riple/core/checkers/nullaway/NullAwayError.java index b6a3564c..0597269c 100644 --- a/annotator-core/src/main/java/edu/ucr/cs/riple/core/checkers/nullaway/NullAwayError.java +++ b/annotator-core/src/main/java/edu/ucr/cs/riple/core/checkers/nullaway/NullAwayError.java @@ -76,7 +76,9 @@ public boolean equals(Object o) { // message and should not be treated as a separate error. return true; } - return message.equals(error.message) && fixes.equals(error.fixes) && offset == error.offset; + return message.equals(error.message) + && resolvingFixes.equals(error.resolvingFixes) + && offset == error.offset; } @Override @@ -86,7 +88,7 @@ public int hashCode() { // to make sure equal objects will produce the same hashcode. messageType.equals(METHOD_INITIALIZER_ERROR) ? METHOD_INITIALIZER_ERROR : message, region, - fixes, + resolvingFixes, offset); } diff --git a/annotator-core/src/main/java/edu/ucr/cs/riple/core/registries/index/Error.java b/annotator-core/src/main/java/edu/ucr/cs/riple/core/registries/index/Error.java index c94da7c2..bd5ffac1 100644 --- a/annotator-core/src/main/java/edu/ucr/cs/riple/core/registries/index/Error.java +++ b/annotator-core/src/main/java/edu/ucr/cs/riple/core/registries/index/Error.java @@ -43,7 +43,7 @@ public abstract class Error { /** Error message. */ public final String message; /** The fixes which can resolve this error (possibly null). */ - protected final Set fixes; + protected final Set resolvingFixes; /** Offset of program point in original version where error is reported. */ protected final int offset; /** Containing region. */ @@ -60,13 +60,13 @@ public Error( this.messageType = messageType; this.message = message; this.offset = offset; - this.fixes = computeFixesFromAnnotations(annotations); + this.resolvingFixes = computeFixesFromAnnotations(annotations); } protected abstract Set computeFixesFromAnnotations(Set annotations); public Set getFixes() { - return this.fixes; + return this.resolvingFixes; } /** @@ -75,7 +75,7 @@ public Set getFixes() { * @return true if error is resolvable with only one annotation and false otherwise. */ public boolean isSingleAnnotationFix() { - return !fixes.isEmpty() && fixes.iterator().next().changes.size() == 1; + return !resolvingFixes.isEmpty() && resolvingFixes.iterator().next().changes.size() == 1; } /** @@ -84,9 +84,10 @@ public boolean isSingleAnnotationFix() { * @return Location of the fix resolving this error. */ public Location toResolvingLocation() { - Preconditions.checkArgument(!fixes.isEmpty() && fixes.iterator().next().changes.size() == 1); + Preconditions.checkArgument( + !resolvingFixes.isEmpty() && resolvingFixes.iterator().next().changes.size() == 1); // no get() method, have to use iterator. - return fixes.iterator().next().changes.iterator().next().getLocation(); + return resolvingFixes.iterator().next().changes.iterator().next().getLocation(); } /** @@ -139,7 +140,7 @@ public boolean equals(Object o) { return messageType.equals(other.messageType) && region.equals(other.region) && message.equals(other.message) - && fixes.equals(other.fixes) + && resolvingFixes.equals(other.resolvingFixes) && offset == other.offset; } @@ -151,14 +152,14 @@ public boolean equals(Object o) { * @return true, if error is resolvable via fixes on target module. */ public boolean isFixableOnTarget(Context context) { - return this.fixes.stream() + return this.resolvingFixes.stream() .flatMap(fix -> fix.changes.stream()) .allMatch(change -> context.targetModuleInfo.declaredInModule(change.getLocation())); } @Override public int hashCode() { - return Objects.hash(messageType, message, region, fixes, offset); + return Objects.hash(messageType, message, region, resolvingFixes, offset); } @Override @@ -182,7 +183,9 @@ public String toString() { */ public static ImmutableSet getResolvingFixesOfErrors( Collection errors) { - return errors.stream().flatMap(t -> t.fixes.stream()).collect(ImmutableSet.toImmutableSet()); + return errors.stream() + .flatMap(t -> t.resolvingFixes.stream()) + .collect(ImmutableSet.toImmutableSet()); } /** @@ -192,9 +195,9 @@ public static ImmutableSet getResolvingFixesOfErrors( * @return true, if this error is resolvable. */ public boolean isResolvableWith(Collection fixes) { - if (this.fixes.isEmpty()) { + if (this.resolvingFixes.isEmpty()) { return false; } - return fixes.containsAll(this.fixes); + return fixes.containsAll(this.resolvingFixes); } }