Support SpEL compilation of #root or #this with non-public type
Prior to this commit, if a Spring Expression Language (SpEL) expression referenced the root context object via the #root or #this variable, we inserted a checkcast in the generated byte code that cast the object to its concrete type. However if the root context object's type was non-public, that resulted in an IllegalAccessError when the compiled byte code was executed. VariableReference.getValueInternal() already contains a solution for global variables which inserts a checkcast to Object in the generated byte code instead of to the object's concrete non-public type. This commit therefore applies the same logic to #root (or #this when used to reference the root context object) that is already applied to global variables. Closes gh-32356
This commit is contained in:
@@ -20,6 +20,15 @@ characters.
|
||||
* dollar sign: `$`
|
||||
====
|
||||
|
||||
[TIP]
|
||||
====
|
||||
When setting a variable or root context object in the `EvaluationContext`, it is advised
|
||||
that the type of the variable or root context object be `public`.
|
||||
|
||||
Otherwise, certain types of SpEL expressions involving a variable or root context object
|
||||
with a non-public type may fail to evaluate or compile.
|
||||
====
|
||||
|
||||
[WARNING]
|
||||
====
|
||||
Since variables share a common namespace with
|
||||
|
||||
Reference in New Issue
Block a user