-
Notifications
You must be signed in to change notification settings - Fork 38.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SpEL compilation fails when indexing into a Map
with a primitive
#32903
Comments
I've edited your comment to improve the formatting. You might want to check out this Mastering Markdown guide for future reference. |
int
to access map instead of Integer
Hi @rmonje, Congratulations on submitting your first issue for the Spring Framework! 👍 I have confirmed that your example fails to compile against Cheers, Sam |
int
to access map instead of Integer
int
to access a Map
int
to access a Map
Map
with a primitive
Prior to this commit, the Spring Expression Language (SpEL) failed to compile an expression that indexed into a Map using a primitive literal (boolean, int, long, float, or double). This commit adds support for compilation of such expressions by ensuring that primitive literals are boxed into their corresponding wrapper types in the compiled bytecode. Closes gh-32903 (cherry picked from commit e9de426)
Prior to this commit, the Spring Expression Language (SpEL) failed to compile an expression that indexed into a Map using a primitive literal (boolean, int, long, float, or double). This commit adds support for compilation of such expressions by ensuring that primitive literals are boxed into their corresponding wrapper types in the compiled bytecode. Closes gh-32903 (cherry picked from commit aed1d5f)
This has been fixed in Feel free to try out the fix in the snapshot builds for 5.3.37, 6.0.22, 6.1.9, and 6.2.0. |
Overview
We have found inconsistent behavior when using a
Map
in a SpEL expression.Example:
mapWithArrays[1] != null && mapWithArrays[1][1] != null
It works the first 100 times it is executed. Then compilation is launched, which throws an exception.
Workaround: use
mapWithArrays[new Integer(1)] != null && mapWithArrays[new Integer(1)][1] != null
ormapWithArrays.get(1) != null && mapWithArrays.get(1)[1] != null
.Reproducer
CompilerTests_.zip
Stacktrace
The text was updated successfully, but these errors were encountered: