diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/MethodReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/MethodReference.java index c4f384f01f..dbd0d9266f 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/MethodReference.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/MethodReference.java @@ -118,8 +118,7 @@ public class MethodReference extends SpelNodeImpl { executorToUse = findAccessorForMethod(this.name, argumentTypes, value, evaluationContext); this.cachedExecutor = new CachedMethodExecutor(executorToUse, targetType, argumentTypes); try { - return executorToUse.execute(evaluationContext, - value, arguments); + return executorToUse.execute(evaluationContext, value, arguments); } catch (AccessException ex) { // Same unwrapping exception handling as above in above catch block @@ -163,8 +162,9 @@ public class MethodReference extends SpelNodeImpl { } private MethodExecutor getCachedExecutor(TypeDescriptor target, List argumentTypes) { - if (this.cachedExecutor != null && this.cachedExecutor.isSuitable(target, argumentTypes)) { - return this.cachedExecutor.get(); + CachedMethodExecutor executorToCheck = this.cachedExecutor; + if (executorToCheck != null && executorToCheck.isSuitable(target, argumentTypes)) { + return executorToCheck.get(); } this.cachedExecutor = null; return null; @@ -249,8 +249,7 @@ public class MethodReference extends SpelNodeImpl { @Override public TypedValue getValue() { - return MethodReference.this.getValueInternal(this.evaluationContext, - this.value, this.arguments, this.targetType); + return getValueInternal(this.evaluationContext, this.value, this.arguments, this.targetType); } @Override