Skip to content

Commit ffbb906

Browse files
committed
Any: use bounds accessors over direct field access
1 parent 4e1f300 commit ffbb906

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

  • scijava-types/src/main/java/org/scijava/types

scijava-types/src/main/java/org/scijava/types/Any.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ public String toString() {
4848
}
4949

5050
// the superclasses of this Any
51-
Type[] upperBounds;
51+
private Type[] upperBounds;
5252
// the subclasses of this Any
53-
Type[] lowerBounds;
53+
private Type[] lowerBounds;
5454

5555
public Any() {
5656
this.upperBounds = new Type[] {};
@@ -79,9 +79,9 @@ public Type[] getLowerBounds() {
7979
* This method returns true iff:
8080
* <ul>
8181
* <li>{@code obj} is an {@link Any}</li>
82-
* <li>{@code obj.getUpperBounds} is equal to {@code upperBounds}
82+
* <li>{@code obj.getUpperBounds} is equal to {@code this.getUpperBounds}
8383
* (disregarding the order of each array)</li>
84-
* <li>{@code obj.getLowerBounds} is equal to {@code lowerBounds}
84+
* <li>{@code obj.getLowerBounds} is equal to {@code this.getLowerBounds}
8585
* (disregarding the order of each array)</li>
8686
* </ul>
8787
* This is a rather strict definition of equality, however it is necessary to
@@ -92,16 +92,16 @@ public boolean equals(Object obj) {
9292
if (!(obj instanceof Any) || obj == null) return false;
9393
Any other = (Any) obj;
9494

95-
return equalBounds(upperBounds, other.getUpperBounds()) && equalBounds(
96-
lowerBounds, other.getLowerBounds());
95+
return equalBounds(getUpperBounds(), other.getUpperBounds()) &&
96+
equalBounds(getLowerBounds(), other.getLowerBounds());
9797
}
9898

9999
@Override
100100
public int hashCode() {
101101
int hash = 0;
102-
for (Type t : upperBounds)
102+
for (Type t : getUpperBounds())
103103
hash ^= t.hashCode();
104-
for (Type t : lowerBounds)
104+
for (Type t : getLowerBounds())
105105
hash ^= t.hashCode();
106106
return hash;
107107
}

0 commit comments

Comments
 (0)