Returns true if Equivalence#equivalent(Object, Object) applied to the wrapped references is true and both wrappers use the Object#equals(Object) same equivalence.
(@Nullable Object obj)
| 211 | */ |
| 212 | |
| 213 | @Override |
| 214 | public boolean equals(@Nullable Object obj) { |
| 215 | if (obj == this) { |
| 216 | return true; |
| 217 | } |
| 218 | if (obj instanceof Wrapper) { |
| 219 | Wrapper<?> that = (Wrapper<?>) obj; // note: not necessarily a Wrapper<T> |
| 220 | if (this.equivalence.equals(that.equivalence)) { |
| 221 | /* |
| 222 | * We'll accept that as sufficient "proof" that either equivalence should be able to |
| 223 | * handle either reference, so it's safe to circumvent compile-time type checking. |
| 224 | */ |
| 225 | @SuppressWarnings("unchecked") |
| 226 | Equivalence<Object> equivalence = (Equivalence<Object>) this.equivalence; |
| 227 | return equivalence.equivalent(this.reference, that.reference); |
| 228 | } |
| 229 | } |
| 230 | return false; |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * Returns the result of {@link Equivalence#hash(Object)} applied to the wrapped reference. |
nothing calls this directly
no test coverage detected