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
This commit is contained in:
Stephane Nicoll
2014-03-06 14:44:13 +01:00
parent c8f2e07182
commit 519799e1cf
2 changed files with 37 additions and 3 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