Do not attempt nested PropertyHandler resolution for argument conversion

This is not actually triggered on 6.2.x but nevertheless worth aligning.
Includes fix for return type declaration in PropertyAccessor subclasses.
Includes related polishing from main commits.

See gh-36024
This commit is contained in:
Juergen Hoeller
2025-12-17 14:56:12 +01:00
parent 91a0c28fa9
commit 9a0bfd7306
6 changed files with 14 additions and 6 deletions
@@ -489,6 +489,9 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
@Override
@Nullable
public Class<?> getPropertyType(String propertyName) throws BeansException {
if (this.wrappedObject == null) {
return null;
}
try {
PropertyHandler ph = getPropertyHandler(propertyName);
if (ph != null) {
@@ -192,7 +192,7 @@ public class BeanWrapperImpl extends AbstractNestablePropertyAccessor implements
@Override
@Nullable
protected BeanPropertyHandler getLocalPropertyHandler(String propertyName) {
protected PropertyHandler getLocalPropertyHandler(String propertyName) {
PropertyDescriptor pd = getCachedIntrospectionResults().getPropertyDescriptor(propertyName);
return (pd != null ? new BeanPropertyHandler((GenericTypeAwarePropertyDescriptor) pd) : null);
}
@@ -73,7 +73,7 @@ public class DirectFieldAccessor extends AbstractNestablePropertyAccessor {
@Override
@Nullable
protected FieldPropertyHandler getLocalPropertyHandler(String propertyName) {
protected PropertyHandler getLocalPropertyHandler(String propertyName) {
FieldPropertyHandler propertyHandler = this.fieldMap.get(propertyName);
if (propertyHandler == null) {
Field field = ReflectionUtils.findField(getWrappedClass(), propertyName);
@@ -39,10 +39,12 @@ class CacheEvaluationContextFactory {
@Nullable
private Supplier<ParameterNameDiscoverer> parameterNameDiscoverer;
CacheEvaluationContextFactory(StandardEvaluationContext originalContext) {
this.originalContext = originalContext;
}
public void setParameterNameDiscoverer(Supplier<ParameterNameDiscoverer> parameterNameDiscoverer) {
this.parameterNameDiscoverer = parameterNameDiscoverer;
}
@@ -54,6 +56,7 @@ class CacheEvaluationContextFactory {
return this.parameterNameDiscoverer.get();
}
/**
* Creates a {@link CacheEvaluationContext} for the specified operation.
* @param rootObject the {@code root} object to use for the context
@@ -237,7 +237,8 @@ class MethodParameterTests {
assertThat(m3.getTypeIndexForCurrentLevel()).isEqualTo(3);
}
public int method(String p1, long p2) {
public int method(String str, long lng) {
return 42;
}
@@ -636,14 +636,15 @@ public abstract class AbstractHandlerMethodMapping<T> extends AbstractHandlerMap
HandlerMethod handlerMethod = createHandlerMethod(handler, method);
validateMethodMapping(handlerMethod, mapping);
Set<String> directPaths = AbstractHandlerMethodMapping.this.getDirectPaths(mapping);
Set<String> directPaths = getDirectPaths(mapping);
for (String path : directPaths) {
this.pathLookup.add(path, mapping);
}
String name = null;
if (getNamingStrategy() != null) {
name = getNamingStrategy().getName(handlerMethod, mapping);
HandlerMethodMappingNamingStrategy<T> namingStrategy = getNamingStrategy();
if (namingStrategy != null) {
name = namingStrategy.getName(handlerMethod, mapping);
addMappingName(name, handlerMethod);
}