Details
-
Improvement
-
Resolution: Fixed
-
Major
-
12.10.4
-
None
Description
When we are calling a Java method from a Velocity script, if no method can be found with the right name and the exact right argument types we are iterating over the method names with the right number of arguments and we are trying to perform argument type conversion to match a method.
This is useful since we have type converter, but this strategy might actually have random results since several methods can be matching and the sorting of velocity methods is random.
So for example, if I have methods getFoo(String, TypeA) and getFoo(String, String), and the converter TypeA <-> String, calling getFoo with two arguments of type TypeA can lead to one method call or the other.
IMO it would make sense that in that specific case, the first method (getFoo(String, TypeA)) is called, since one of the argument type is an exact match. So I think we should improve this strategy to count the actual number of arguments that needs a conversion for deciding which method to chose.