Fix double SPeL evaluation of parameter

When a node of an SPeL expression was a call to a bean referenced
 in a method argument, the expression was resolved twice.

 The resolved arguments are now specified to MethodValueRef instead
 of resolving the arguments again in the constructor

 Issue: SPR-11445
(cherry picked from commit 519799e)
This commit is contained in:
Stephane Nicoll
2014-03-06 14:44:13 +01:00
committed by Juergen Hoeller
parent f1ba789494
commit b1bcc5d6eb
2 changed files with 528 additions and 405 deletions

View File

@@ -68,7 +68,7 @@ public class MethodReference extends SpelNodeImpl {
throwIfNotNullSafe(getArgumentTypes(arguments));
return ValueRef.NullValueRef.instance;
}
return new MethodValueRef(state);
return new MethodValueRef(state, arguments);
}
@Override
@@ -246,11 +246,11 @@ public class MethodReference extends SpelNodeImpl {
private final Object[] arguments;
public MethodValueRef(ExpressionState state) {
public MethodValueRef(ExpressionState state, Object[] arguments) {
this.evaluationContext = state.getEvaluationContext();
this.value = state.getActiveContextObject().getValue();
this.targetType = state.getActiveContextObject().getTypeDescriptor();
this.arguments = getArguments(state);
this.arguments = arguments;
}
@Override