Revert "AbstractPersistentProperty now considers the owner for equals."

This reverts commit 633d125f1d.

The change caused build failures for Spring Data JDBC.

See #2972
Original pull request #2973
See spring-projects/spring-data-relational#1657
This commit is contained in:
Jens Schauder
2023-11-12 11:02:46 +01:00
parent 42badf256f
commit 3eda7e9e66
2 changed files with 18 additions and 26 deletions

View File

@@ -20,7 +20,6 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Collections;
import java.util.HashSet;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@@ -42,7 +41,6 @@ import org.springframework.util.Assert;
* @author Oliver Gierke
* @author Christoph Strobl
* @author Mark Paluch
* @author Jens Schauder
*/
public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>> implements PersistentProperty<P> {
@@ -89,7 +87,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
this.association = Lazy.of(() -> isAssociation() ? createAssociation() : null);
this.owner = owner;
this.hashCode = Lazy.of(() -> Objects.hash(property, owner));
this.hashCode = Lazy.of(property::hashCode);
this.usePropertyAccess = Lazy.of(() -> owner.getType().isInterface() || CAUSE_FIELD.equals(getField()));
this.isAssociation = Lazy.of(() -> ASSOCIATION_TYPE != null && ASSOCIATION_TYPE.isAssignableFrom(rawType));
@@ -319,7 +317,7 @@ public abstract class AbstractPersistentProperty<P extends PersistentProperty<P>
return false;
}
return this.property.equals(that.property) && this.owner.equals(that.owner);
return this.property.equals(that.property);
}
@Override