Skip to content

Commit 021e8e4

Browse files
committed
AccessorLValue reliably downcasts to CompilablePropertyAccessor in concurrent scenarios
Issue: SPR-14850 (cherry picked from commit 5697cb6)
1 parent fe333e4 commit 021e8e4

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -371,10 +371,12 @@ public AccessorLValue(PropertyOrFieldReference propertyOrFieldReference, TypedVa
371371

372372
@Override
373373
public TypedValue getValue() {
374-
TypedValue value = this.ref.getValueInternal(this.contextObject, this.evalContext, this.autoGrowNullReferences);
375-
if (this.ref.cachedReadAccessor instanceof CompilablePropertyAccessor) {
376-
CompilablePropertyAccessor accessor = (CompilablePropertyAccessor) this.ref.cachedReadAccessor;
377-
this.ref.exitTypeDescriptor = CodeFlow.toDescriptor(accessor.getPropertyType());
374+
TypedValue value =
375+
this.ref.getValueInternal(this.contextObject, this.evalContext, this.autoGrowNullReferences);
376+
PropertyAccessor accessorToUse = this.ref.cachedReadAccessor;
377+
if (accessorToUse instanceof CompilablePropertyAccessor) {
378+
this.ref.exitTypeDescriptor =
379+
CodeFlow.toDescriptor(((CompilablePropertyAccessor) accessorToUse).getPropertyType());
378380
}
379381
return value;
380382
}

0 commit comments

Comments
 (0)