You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add SpEL support for float literals [SPR-9486] #14121
public class FunctionsClass {
public int abs(int value) { return Math.abs(value); }
public float abs(float value) { return Math.abs(value); } }
}
and when I execute the test with following code:
FunctionsClass testObject = new FunctionsClass();
StandardEvaluationContext context = new StandardEvaluationContext();
org.springframework.expression.Expression expression = parser.parseExpression("abs(-10.2f)");
Number result = expression.getValue(context, testObject, Number.class);
it fails with:
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1033E:(pos 0): Method call of 'abs' is ambiguous, supported type conversions allow multiple variants to match
This is due to -10.2f being treated as double, and then they are eligible for type conversions to int and float and hence the ambiguity
I have a potential fix for this and wondering if I should go github route to submit my fix. We are releasing our product in next two months and wondering if we could this fix.
commit be8f23d75658a8b728912b644c138407d4914f8b
Author: Satyapal Reddy <[email protected]>
Commit: Chris Beams <[email protected]>
Add SpEL support for float literals
This change ensures that SpEL expressions involving floats are
supported natively as opposed to the previous behavior which required
conversion to double, leading to potential downstream conversion
ambiguities.
Issue: SPR-9486
3.1.3 (3.1.x):
commit a94677e7b6d6c6f506a7ac06d9958cb780d42fbb
Author: Satyapal Reddy <[email protected]>
Commit: Chris Beams <[email protected]>
Add SpEL support for float literals
This change ensures that SpEL expressions involving floats are
supported natively as opposed to the previous behavior which required
conversion to double, leading to potential downstream conversion
ambiguities.
Issue: SPR-9486
Backport-Commit: be8f23d75658a8b728912b644c138407d4914f8b
Update: several related commits followed those shown above in order to catch a couple failing tests. git log --grep SPR-9486 on master or 3.1.x to see everything.
Activity
spring-projects-issues commentedon Jun 28, 2012
Satyapal Reddy commented
I have a potential fix for this and wondering if I should go github route to submit my fix. We are releasing our product in next two months and wondering if we could this fix.
Thanks
spring-projects-issues commentedon Jun 29, 2012
Chris Beams commented
Hi Satya,
Please do go ahead with a pull request per the contributor guidelines, and I'll follow up from there. Thanks!
spring-projects-issues commentedon Aug 6, 2012
Satyapal Reddy commented
I made a pull request : #114
spring-projects-issues commentedon Aug 6, 2012
Chris Beams commented
@Andy(added as watcher), you might want to take a look at this pull request and comment: #114spring-projects-issues commentedon Aug 10, 2012
Satyapal Reddy commented
Thanks for the comments on the pull request Andy.
We currently use 3.1.1 of spring framework. Is there any possibility of backporting this fix to 3.1.x?
spring-projects-issues commentedon Aug 16, 2012
Satyapal Reddy commented
Hi Chris,
Any chance this can make into 3.1.3 ?
Satya
spring-projects-issues commentedon Oct 18, 2012
Chris Beams commented
Hi Satya, yes, I've just scheduled this for 3.1.3.
spring-projects-issues commentedon Oct 24, 2012
Chris Beams commented
3.2 RC1 (master):
3.1.3 (3.1.x):
Update: several related commits followed those shown above in order to catch a couple failing tests.
git log --grep SPR-9486onmasteror3.1.xto see everything.