apache / incubator-kie-issues

Apache License 2.0
11 stars 1 forks source link

DMN: refactor BaseFEELFunction getCandidateMethod #1370

Open gitgabrio opened 3 days ago

gitgabrio commented 3 days ago

THe BaseFEELFunction.getCandidateMethod is used to find /by reflection) the beste method to be invoked for BaseFunction execution. The current implementation iterates over all the invoke methods available in the current class, and look for the best match. At the same time, it also "modify/adapt" input parameter, to find a possible "coerced" match (e.g. single item -> singleton list). The problem with the current implementation is that it is hard to modify and somehow fragile, since it is cumebrsome to understand if a given match, found from "coerced" parameter, is actually "best" then another one (there is a score mechanism, but it seems also somehow limited). BEside all of that, the method itself is a big, untested, black box, and being a critical part of execution, it should be deeped unit-tested.

Scope of this ticket is to revisit the overall implementation and see if it is possible a different, clearer, and extensively tested solution