@@ -1904,6 +1904,21 @@ public void SPR12803() throws Exception {
1904
1904
assertTrue (expression .getValue (sec ) instanceof ArrayList );
1905
1905
}
1906
1906
1907
+ @ Test
1908
+ public void SPR12808 () throws Exception {
1909
+ SpelExpressionParser parser = new SpelExpressionParser ();
1910
+ Expression expression = parser .parseExpression ("T(org.springframework.expression.spel.SpelReproTests.DistanceEnforcer).from(#no)" );
1911
+ StandardEvaluationContext sec = new StandardEvaluationContext ();
1912
+ sec .setVariable ("no" , new Integer (1 ));
1913
+ assertTrue (expression .getValue (sec ).toString ().startsWith ("Integer" ));
1914
+ sec = new StandardEvaluationContext ();
1915
+ sec .setVariable ("no" , new Float (1.0 ));
1916
+ assertTrue (expression .getValue (sec ).toString ().startsWith ("Number" ));
1917
+ sec = new StandardEvaluationContext ();
1918
+ sec .setVariable ("no" , "1.0" );
1919
+ assertTrue (expression .getValue (sec ).toString ().startsWith ("Object" ));
1920
+ }
1921
+
1907
1922
1908
1923
private static enum ABC { A , B , C }
1909
1924
@@ -2201,4 +2216,20 @@ public static <T> List<T> newArrayList(Object... elements) {
2201
2216
}
2202
2217
}
2203
2218
2219
+
2220
+ public static class DistanceEnforcer {
2221
+
2222
+ public static String from (Number no ) {
2223
+ return "Number:" + no .toString ();
2224
+ }
2225
+
2226
+ public static String from (Integer no ) {
2227
+ return "Integer:" + no .toString ();
2228
+ }
2229
+
2230
+ public static String from (Object no ) {
2231
+ return "Object:" + no .toString ();
2232
+ }
2233
+ }
2234
+
2204
2235
}
0 commit comments