Skip to content

Use the 4-argument Property constructor in SpEL's ReflectivePropertyAccessor #37123

Description

@sbrannen

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

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: bugA general bug

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions