1515 */
1616package org .springframework .data .mapping ;
1717
18- import java .beans .IntrospectionException ;
1918import java .beans .Introspector ;
2019import java .beans .PropertyDescriptor ;
2120import java .io .IOException ;
3736import java .util .stream .Stream ;
3837
3938import org .jspecify .annotations .Nullable ;
39+
4040import org .springframework .asm .ClassReader ;
4141import org .springframework .asm .ClassVisitor ;
4242import org .springframework .asm .Label ;
@@ -103,12 +103,12 @@ public static <P, T> TypedPropertyPath<T, P> of(TypedPropertyPath<T, P> lambda)
103103
104104 /**
105105 * Value object holding information about a property path segment.
106- *
106+ *
107107 * @param owner
108108 * @param propertyType
109109 * @param property
110110 */
111- record PropertyPathInformation (TypeInformation <?> owner , TypeInformation <?> propertyType , Property property ) {
111+ record PropertyPathInformation (TypeInformation <?> owner , TypeInformation <?> propertyType , String property ) {
112112
113113 public static PropertyPathInformation ofInvokeVirtual (ClassLoader classLoader , SerializedLambda lambda )
114114 throws ClassNotFoundException {
@@ -142,13 +142,8 @@ public static PropertyPathInformation ofInvokeVirtual(Class<?> owner, String met
142142
143143 TypeInformation <?> fallback = TypeInformation .of (owner ).getProperty (propertyName );
144144 if (fallback != null ) {
145- try {
146145 return new PropertyPathInformation (TypeInformation .of (owner ), fallback ,
147- Property .of (TypeInformation .of (owner ), new PropertyDescriptor (propertyName , method , null )));
148- } catch (IntrospectionException e ) {
149- throw new IllegalArgumentException (
150- "Cannot find PropertyDescriptor from method %s.%s" .formatted (owner .getName (), methodName ), e );
151- }
146+ propertyName );
152147 }
153148
154149 throw new IllegalArgumentException (
@@ -157,7 +152,7 @@ public static PropertyPathInformation ofInvokeVirtual(Class<?> owner, String met
157152
158153 return new PropertyPathInformation (TypeInformation .of (owner ),
159154 TypeInformation .of (ResolvableType .forMethodReturnType (method , owner )),
160- Property . of ( TypeInformation . of ( owner ), descriptor ));
155+ descriptor . getName ( ));
161156 }
162157
163158 public static PropertyPathInformation ofFieldAccess (ClassLoader classLoader , Type ownerType , String name ,
@@ -177,7 +172,7 @@ public static PropertyPathInformation ofFieldAccess(Class<?> owner, String field
177172 }
178173
179174 return new PropertyPathInformation (TypeInformation .of (owner ),
180- TypeInformation .of (ResolvableType .forField (field , owner )), Property . of ( TypeInformation . of ( owner ), field ));
175+ TypeInformation .of (ResolvableType .forField (field , owner )), field . getName ( ));
181176 }
182177 }
183178
@@ -296,7 +291,7 @@ public TypeInformation<?> getOwningType() {
296291
297292 @ Override
298293 public String getSegment () {
299- return information .property (). getName () ;
294+ return information .property ();
300295 }
301296
302297 @ Override
@@ -309,6 +304,7 @@ public Iterator<PropertyPath> iterator() {
309304 return list .iterator ();
310305 }
311306
307+ @ Override
312308 public Stream <PropertyPath > stream () {
313309 return list .stream ();
314310 }
0 commit comments