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)
| 193 | * equivalence. |
| 194 | */ |
| 195 | @Override |
| 196 | public boolean equals(@Nullable Object obj) { |
| 197 | if (obj == this) { |
| 198 | return true; |
| 199 | } |
| 200 | if (obj instanceof Wrapper) { |
| 201 | Wrapper<?> that = (Wrapper<?>) obj; // note: not necessarily a Wrapper<T> |
| 202 | |
| 203 | if (this.equivalence.equals(that.equivalence)) { |
| 204 | /* |
| 205 | * We'll accept that as sufficient "proof" that either equivalence should be able to |
| 206 | * handle either reference, so it's safe to circumvent compile-time type checking. |
| 207 | */ |
| 208 | @SuppressWarnings("unchecked") |
| 209 | Equivalence<Object> equivalence = (Equivalence<Object>) this.equivalence; |
| 210 | return equivalence.equivalent(this.reference, that.reference); |
| 211 | } |
| 212 | } |
| 213 | return false; |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * Returns the result of {@link Equivalence#hash(Object)} applied to the wrapped reference. |
nothing calls this directly
no test coverage detected