Chooses the best method declared directly on the supplied meta class. @param instanceKlazz the runtime receiver class @param methodName the method name @param arguments the parameter types @param metaClass the meta class being inspected @param method the current best method candidate @return the up
(Class instanceKlazz, String methodName, Class[] arguments, MetaClass metaClass, MetaMethod method)
| 4079 | * @return the updated best method candidate |
| 4080 | */ |
| 4081 | protected static MetaMethod findOwnMethod(Class instanceKlazz, String methodName, Class[] arguments, MetaClass metaClass, MetaMethod method) { |
| 4082 | if (instanceKlazz != metaClass.getTheClass()) { |
| 4083 | MetaMethod ownMethod = metaClass.pickMethod(methodName, arguments); |
| 4084 | if (ownMethod != null && !isPrivate(ownMethod, instanceKlazz)) { // GROOVY-10198 |
| 4085 | method = (method == null ? ownMethod : mostSpecific(method, ownMethod, instanceKlazz)); |
| 4086 | } |
| 4087 | } |
| 4088 | return method; |
| 4089 | } |
| 4090 | |
| 4091 | private static boolean isPrivate(MetaMethod method, Class instanceKlazz) { |
| 4092 | return method.isPrivate() || (method.isPackagePrivate() && !inSamePackage(method.getDeclaringClass().getTheClass(), instanceKlazz)); |
no test coverage detected