(Method[] methods, String name, List<Object> args)
| 841 | } |
| 842 | |
| 843 | private static Method findCompatibleIn(Method[] methods, String name, List<Object> args) { |
| 844 | for (Method m : methods) { |
| 845 | if (!m.getName().equals(name)) continue; |
| 846 | |
| 847 | Class<?>[] p = m.getParameterTypes(); |
| 848 | if (p.length != args.size()) continue; |
| 849 | |
| 850 | boolean ok = true; |
| 851 | for (int i = 0; i < p.length; i++) { |
| 852 | Object a = args.get(i); |
| 853 | if (a == null) continue; |
| 854 | if (!isAssignable(p[i], a.getClass())) { |
| 855 | ok = false; |
| 856 | break; |
| 857 | } |
| 858 | } |
| 859 | if (ok) return m; |
| 860 | } |
| 861 | return null; |
| 862 | } |
| 863 | |
| 864 | private static boolean isAssignable(Class<?> paramType, Class<?> argType) { |
| 865 | if (paramType.isPrimitive()) paramType = boxPrimitive(paramType); |
no test coverage detected