PMD: AbstractReferenceMap.WeakRef implements hashCode() but not equals()
This commit is contained in:
parent
d22eb8951b
commit
fe28f8689e
|
@ -109,6 +109,9 @@
|
|||
<action type="fix" dev="ggregory" due-to="Gary Gregory">
|
||||
AbstractReferenceMap.SoftRef implements hashCode() but not equals().
|
||||
</action>
|
||||
<action type="fix" dev="ggregory" due-to="Gary Gregory">
|
||||
AbstractReferenceMap.WeakRef implements hashCode() but not equals().
|
||||
</action>
|
||||
<!-- ADD -->
|
||||
<action issue="COLLECTIONS-760" dev="kinow" type="add" due-to="Isira Seneviratne">
|
||||
Add tests for MapUtils.
|
||||
|
|
|
@ -978,7 +978,7 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
|
|||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
SoftRef<?> other = (SoftRef<?>) obj;
|
||||
final SoftRef<?> other = (SoftRef<?>) obj;
|
||||
return hash == other.hash;
|
||||
}
|
||||
}
|
||||
|
@ -999,6 +999,21 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
|
|||
public int hashCode() {
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final WeakRef<?> other = (WeakRef<?>) obj;
|
||||
return hash == other.hash;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue