-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
Satyapal Reddy opened SPR-9486 and commented
I have two functions:
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
Affects: 3.1.1
Attachments:
- SpELFloatLiteralTest.java (1.24 kB)
Issue Links:
- Support BigDecimals with SpEL [SPR-9164] #13802 Support BigDecimals with SpEL
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement