Overview
While reviewing #36911, I noticed that ReflectivePropertyAccessor currently invokes the 3-argument Property constructor which does not accept a predetermined property name and therefore ends up invoking org.springframework.core.convert.Property.resolveName().
However, the invocation of resolveName() seems unnecessary, since ReflectivePropertyAccessor already knows the name of the property.
Background
The 3-argument Property constructor has been in use since SpEL was introduced; whereas, the 4-argument Property constructor was added in 2012, in commit ca017a4 ("Introduce strategy for BeanInfo creation", SPR-9677) whose commit message states it was added specifically "allowing BeanWrapperImpl to specify the property name at construction time (as opposed to using Property#resolveName(), which supports the JavaBeans contract only)". So, it seems like it was simply an oversight not to migrate to the new Property constructor back then.
Related Issues
Overview
While reviewing #36911, I noticed that
ReflectivePropertyAccessorcurrently invokes the 3-argumentPropertyconstructor which does not accept a predetermined property name and therefore ends up invokingorg.springframework.core.convert.Property.resolveName().However, the invocation of
resolveName()seems unnecessary, sinceReflectivePropertyAccessoralready knows the name of the property.Background
The 3-argument
Propertyconstructor has been in use since SpEL was introduced; whereas, the 4-argumentPropertyconstructor was added in 2012, in commit ca017a4 ("Introduce strategy for BeanInfo creation", SPR-9677) whose commit message states it was added specifically "allowing BeanWrapperImpl to specify the property name at construction time (as opposed to using Property#resolveName(), which supports the JavaBeans contract only)". So, it seems like it was simply an oversight not to migrate to the newPropertyconstructor back then.Related Issues