### Question:
TransparentEqualsWeakReference extends WeakReference<T> { @Override @SuppressWarnings("PMD.CompareObjectsWithEquals") public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } TransparentEqualsWeakReference<?> other = (TransparentEqualsWeakReference<?>)obj; if (myHashCode != other.myHashCode) { return false; } T referent = get(); Object otherReferent = other.get(); return referent == otherReferent || referent != null && referent.equals(otherReferent); } TransparentEqualsWeakReference(T referent);  TransparentEqualsWeakReference(T referent, ReferenceQueue<? super T> q); static TransparentEqualsWeakReference<T> create(T referent); static TransparentEqualsWeakReference<T> create(T referent, ReferenceQueue<? super T> q); @Override @SuppressWarnings("PMD.CompareObjectsWithEquals") boolean equals(Object obj); @Override int hashCode();  }### Answer:
@Test public void testEqualsObject() { TestClass testObj1 = new TestClass(); TestClass testObj2 = new TestClass(); TransparentEqualsWeakReference<TestClass> ref1a = new TransparentEqualsWeakReference<TransparentEqualsWeakReferenceTest.TestClass>( testObj1); TransparentEqualsWeakReference<TestClass> ref1b = new TransparentEqualsWeakReference<TransparentEqualsWeakReferenceTest.TestClass>( testObj1); TransparentEqualsWeakReference<TestClass> ref2 = new TransparentEqualsWeakReference<TransparentEqualsWeakReferenceTest.TestClass>( testObj2); Assert.assertTrue(ref1a.equals(ref1b)); Assert.assertTrue(ref1b.equals(ref1a)); Assert.assertFalse(ref2.equals(ref1a)); Assert.assertFalse(ref1a.equals(ref2)); }