MethodReference treats proxy-targeting expressions as non-compilable
Issue: SPR-16191
This commit is contained in:
@@ -19,6 +19,7 @@ package org.springframework.expression.spel.ast;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -260,7 +261,8 @@ public class MethodReference extends SpelNodeImpl {
|
||||
@Override
|
||||
public boolean isCompilable() {
|
||||
CachedMethodExecutor executorToCheck = this.cachedExecutor;
|
||||
if (executorToCheck == null || !(executorToCheck.get() instanceof ReflectiveMethodExecutor)) {
|
||||
if (executorToCheck == null || executorToCheck.hasProxyTarget() ||
|
||||
!(executorToCheck.get() instanceof ReflectiveMethodExecutor)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -274,8 +276,7 @@ public class MethodReference extends SpelNodeImpl {
|
||||
if (executor.didArgumentConversionOccur()) {
|
||||
return false;
|
||||
}
|
||||
Method method = executor.getMethod();
|
||||
Class<?> clazz = method.getDeclaringClass();
|
||||
Class<?> clazz = executor.getMethod().getDeclaringClass();
|
||||
if (!Modifier.isPublic(clazz.getModifiers()) && executor.getPublicDeclaringClass() == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -400,6 +401,10 @@ public class MethodReference extends SpelNodeImpl {
|
||||
ObjectUtils.nullSafeEquals(this.target, target) && this.argumentTypes.equals(argumentTypes));
|
||||
}
|
||||
|
||||
public boolean hasProxyTarget() {
|
||||
return (this.target != null && Proxy.isProxyClass(this.target.getType()));
|
||||
}
|
||||
|
||||
public MethodExecutor get() {
|
||||
return this.methodExecutor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user