-
Couldn't load subscription status.
- Fork 38.8k
Description
Andy Clement opened SPR-12789 and commented
A few people have noticed that we are currently quite strict on what mathematical expressions we will 'compile' in SpEL. For the standard operators (plus, minus, divide, multiply) we require the operands to be exactly the same type. E.g. both ints, both doubles, both floats, etc. Due to this strict rule you sometimes have to write something funky to get the compiler to compile your expression:
(T(java.lang.Double).parseDouble(payload.someBoxedInt.toString()))/60D
Basically perform a conversion yourself to ensure the operands are compatible. This was done deliberately as we didn't have use cases and every bit of extra flexibility needs many more test cases and enhanced byte code generation - some of the expressions you can write naturally in Java cause extra byte code to be generated that you aren't aware of for converting numbers and we'd need to start generating that too (instructions like i2d). The XD/Integration teams have hit this problem a couple of times.
Under this jira I'd try to lift the restriction.
Juergen (or someone) - are there any upcoming deadlines that you would want me to hit (or not hit) with this feature?
Affects: 4.1.5
Referenced from: commits b7ef047