From 1ea593e777dcff86242e9b882946adbe8f6bb769 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Tue, 5 Mar 2024 11:55:35 +0100 Subject: [PATCH] Convert PropertyCacheKey to a record --- .../support/ReflectivePropertyAccessor.java | 33 ++----------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java index b7f892f6cc5..239f67160c1 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/support/ReflectivePropertyAccessor.java @@ -581,37 +581,8 @@ public class ReflectivePropertyAccessor implements PropertyAccessor { */ private record InvokerPair(Member member, TypeDescriptor typeDescriptor) {} - private static final class PropertyCacheKey implements Comparable { - - private final Class clazz; - - private final String property; - - private final boolean targetIsClass; - - public PropertyCacheKey(Class clazz, String name, boolean targetIsClass) { - this.clazz = clazz; - this.property = name; - this.targetIsClass = targetIsClass; - } - - @Override - public boolean equals(@Nullable Object other) { - return (this == other || (other instanceof PropertyCacheKey that && - this.clazz == that.clazz && this.property.equals(that.property) && - this.targetIsClass == that.targetIsClass)); - } - - @Override - public int hashCode() { - return (this.clazz.hashCode() * 29 + this.property.hashCode()); - } - - @Override - public String toString() { - return "PropertyCacheKey [clazz=" + this.clazz.getName() + ", property=" + this.property + - ", targetIsClass=" + this.targetIsClass + "]"; - } + private record PropertyCacheKey(Class clazz, String property, boolean targetIsClass) + implements Comparable { @Override public int compareTo(PropertyCacheKey other) {