From 5697cb6c952f44927029681b1d41c807e50bc6eb Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 28 Oct 2016 15:15:38 +0200 Subject: [PATCH] AccessorLValue reliably downcasts to CompilablePropertyAccessor in concurrent scenarios Issue: SPR-14850 (cherry picked from commit e2b1dcb) --- .../spel/ast/PropertyOrFieldReference.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java b/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java index 89b9081db7e..a6d36cf3f38 100644 --- a/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java +++ b/spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -371,10 +371,12 @@ public class PropertyOrFieldReference extends SpelNodeImpl { @Override public TypedValue getValue() { - TypedValue value = this.ref.getValueInternal(this.contextObject, this.evalContext, this.autoGrowNullReferences); - if (this.ref.cachedReadAccessor instanceof CompilablePropertyAccessor) { - CompilablePropertyAccessor accessor = (CompilablePropertyAccessor) this.ref.cachedReadAccessor; - this.ref.exitTypeDescriptor = CodeFlow.toDescriptor(accessor.getPropertyType()); + TypedValue value = + this.ref.getValueInternal(this.contextObject, this.evalContext, this.autoGrowNullReferences); + PropertyAccessor accessorToUse = this.ref.cachedReadAccessor; + if (accessorToUse instanceof CompilablePropertyAccessor) { + this.ref.exitTypeDescriptor = + CodeFlow.toDescriptor(((CompilablePropertyAccessor) accessorToUse).getPropertyType()); } return value; }