Skip to content

Commit e2b1dcb

Browse files
committed
AccessorLValue reliably downcasts to CompilablePropertyAccessor in concurrent scenarios
Issue: SPR-14850
1 parent b7d3a96 commit e2b1dcb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

spring-expression/src/main/java/org/springframework/expression/spel/ast/PropertyOrFieldReference.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,12 @@ public AccessorLValue(PropertyOrFieldReference propertyOrFieldReference, TypedVa
354354

355355
@Override
356356
public TypedValue getValue() {
357-
TypedValue value = this.ref.getValueInternal(this.contextObject, this.evalContext, this.autoGrowNullReferences);
358-
if (this.ref.cachedReadAccessor instanceof CompilablePropertyAccessor) {
359-
CompilablePropertyAccessor accessor = (CompilablePropertyAccessor) this.ref.cachedReadAccessor;
360-
this.ref.exitTypeDescriptor = CodeFlow.toDescriptor(accessor.getPropertyType());
357+
TypedValue value =
358+
this.ref.getValueInternal(this.contextObject, this.evalContext, this.autoGrowNullReferences);
359+
PropertyAccessor accessorToUse = this.ref.cachedReadAccessor;
360+
if (accessorToUse instanceof CompilablePropertyAccessor) {
361+
this.ref.exitTypeDescriptor =
362+
CodeFlow.toDescriptor(((CompilablePropertyAccessor) accessorToUse).getPropertyType());
361363
}
362364
return value;
363365
}

0 commit comments

Comments
 (0)