for example, there is a function:
public static void myFunc(List<Double> param) {
xxxx;
}
here I have a List<Integer> list = new ArrayList<>();
If I look for the function myFunc through reflection, I can only find it through the Calss of the parameter like this:Method method = XXX.class.getMethod("myFunc", List.class);, but obviously my passed-in parameter type does not match.
So, is there any good way to find the function through the Type of the parameter? More specifically, how to find the appropriate target function by passing-in parameters with generic?
I wrote a DSL using antlr4, and now can infer the Type of each function call parameter, but can't easily find the right function through the parameter Type. And I tried to write a function to find the function through Type, and found that the implementation is very complicated and error-prone.