Get the candidate methods by searching the class and interface graph of baseClass and resolve the most specific. @return the method or null for not found
(final Class baseClass, final String methodName, final Class[] types, final boolean publicOnly)
| 476 | * @return the method or null for not found |
| 477 | */ |
| 478 | private static Method findOverloadedMethod(final Class baseClass, final String methodName, final Class[] types, final boolean publicOnly) { |
| 479 | if (Interpreter.DEBUG) { |
| 480 | Interpreter.debug("Searching for method: " + StringUtil.methodString(methodName, types) + " in '" + baseClass.getName() + "'"); |
| 481 | } |
| 482 | final List<Method> publicMethods = new ArrayList<Method>(); |
| 483 | final Collection<Method> nonPublicMethods = publicOnly ? new DummyCollection<Method>() : new ArrayList<Method>(); |
| 484 | collectMethods(baseClass, methodName, types.length, publicMethods, nonPublicMethods); |
| 485 | Collections.sort(publicMethods, METHOD_COMPARATOR); |
| 486 | Method method = findMostSpecificMethod(types, publicMethods); |
| 487 | if (method == null) { |
| 488 | method = findMostSpecificMethod(types, nonPublicMethods); |
| 489 | } |
| 490 | return method; |
| 491 | } |
| 492 | |
| 493 | |
| 494 | /** |
no test coverage detected