Search in the already found methods' list and check if it contains
a method which is overriding the method parameter or is the method
parameter itself.

@param method MethodDoc Method to be searched in the Method List for
an overriding method.
961457
private boolean overridingMethodFound(ExecutableElement method) {
        TypeElement containingClass = utils.getEnclosingTypeElement(method);
        for (ExecutableElement listmethod : methlist) {
            if (containingClass == utils.getEnclosingTypeElement(listmethod)) {
                // it's the same method.
                return true;
            }
            TypeElement te = utils.overriddenClass(listmethod);
            if (te == null) {
                continue;
            }
            if (te == containingClass || utils.isSubclassOf(te, containingClass)) {
                return true;
            }
        }
        return false;
    }
621008
private static boolean implementsMethod(ClassNode classNode, String methodName, Class[] argTypes) {
        List methods = classNode.getMethods();
        if (argTypes == null || argTypes.length ==0) {
            for (Iterator i = methods.iterator(); i.hasNext();) {
                MethodNode mn = (MethodNode) i.next();
                boolean methodMatch = mn.getName().equals(methodName);
                if(methodMatch)return true;
                // TODO Implement further parameter analysis
            }
        }
        return false;
    }
255723
static Method findMatchingMethod(Map<String, List<Method>> methodsByName, com.ibm.ws.javaee.dd.ejb.Method me) {
        List<Method> methods = methodsByName.get(me.getMethodName());
        if (methods == null) {
            return null;
        }

        List<String> meParms = me.getMethodParamList();
        if (meParms == null) {
            return methods.get(0);
        }

        for (Method method : methods) {
            if (DDUtil.methodParamsMatch(meParms, method.getParameterTypes())) {
                return method;
            }
        }

        return null;
    }
168780
public static void checkUnusedParameters(SQLiteModelMethod method, Set<String> usedMethodParameters, TypeName excludedClasses) {
		int paramsCount = method.getParameters().size();
		int usedCount = usedMethodParameters.size();

		if (paramsCount > usedCount) {
			StringBuilder sb = new StringBuilder();
			String separator = "";
			for (Pair<String, TypeName> item : method.getParameters()) {
				if (excludedClasses != null && item.value1.equals(excludedClasses)) {
					usedCount++;
				} else {
					if (!usedMethodParameters.contains(item.value0)) {
						sb.append(separator + "'" + item.value0 + "'");
						separator = ", ";
					}
				}
			}

			if (paramsCount > usedCount) {
				throw (new InvalidMethodSignException(method, "unused parameter(s) " + sb.toString()));
			}
		}
	}
520691
private boolean checkForDefaultImplementation(Class checkClass, String checkMethod, Class[] methodParams){
		
	    if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE))  //306998.14
	    	logger.exiting(CLASS_NAME,"checkForDefaultImplementation","Method : " + checkMethod + ", Class : " + checkClass.getName());
		
		
		boolean defaultMethodInUse=true;
		
		while (defaultMethodInUse && checkClass!=null && !checkClass.getName().equals("javax.servlet.http.HttpServlet")) {
		    try {  
		    						       
		        checkClass.getDeclaredMethod(checkMethod, methodParams);
			
			    if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE))  //306998.14
			    	logger.logp(Level.FINE, CLASS_NAME,"checkForDefaultImplementation","Class implementing " + checkMethod + " is " + checkClass.getName());
			
			    defaultMethodInUse=false;
			    break;
			     
		    } catch (java.lang.NoSuchMethodException exc) {    	
			    if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE))  //306998.14
			    	logger.logp(Level.FINE, CLASS_NAME,"checkForDefaultImplementation",checkMethod + " is not implemented by class " + checkClass.getName()); 
		    } catch (java.lang.SecurityException exc) {
			    if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE))  //306998.14
			    	logger.logp(Level.FINE, CLASS_NAME,"checkForDefaultImplementation","Cannot determine if " + checkMethod + " is implemented by class " + checkClass.getName());				    	
		    }
		    
		    checkClass = checkClass.getSuperclass();
	    }  
	    if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable (Level.FINE))  //306998.14
	    	logger.exiting(CLASS_NAME,"checkForDefaultImplementation","Result : " + defaultMethodInUse);
	    
        return defaultMethodInUse;
	}
1373661
public static boolean isToStringMethod(Method method) {
        return (method != null && method.getName().equals("readString") && method.getParameterTypes().length == 0);
    }
971197
public static boolean isEqualsMethod(Method method) {
		if (method == null || false == method.getName().equals("equals")) {
			return false;
		}
		final Class<?>[] paramTypes = method.getParameterTypes();
		return (1 == paramTypes.length && paramTypes[0] == Object.class);
	}
707383
@Override
  public Description matchMethod(MethodTree tree, VisitorState state) {
    MethodSymbol methodSym = ASTHelpers.getSymbol(tree);
    if (methodSym == null) {
      return Description.NO_MATCH;
    }

    // Allow abstract methods.
    if (methodSym.getModifiers().contains(Modifier.ABSTRACT)) {
      return Description.NO_MATCH;
    }

    String annotatedSuperMethod = null;
    String matchedAnnotationSimpleName = null;
    for (MethodSymbol method : ASTHelpers.findSuperMethods(methodSym, state.getTypes())) {
      for (AnnotationType annotationType : AnnotationType.values()) {
        if (ASTHelpers.hasAnnotation(method, annotationType.fullyQualifiedName(), state)) {
          annotatedSuperMethod = getMethodName(method);
          matchedAnnotationSimpleName = annotationType.simpleName();
          break;
        }
      }
    }

    if (annotatedSuperMethod == null || matchedAnnotationSimpleName == null) {
      return Description.NO_MATCH;
    }

    TreeScanner<Boolean, Void> findSuper = new FindSuperTreeScanner(tree.getName().toString());
    if (findSuper.scan(tree, null)) {
      return Description.NO_MATCH;
    }

    return buildDescription(tree)
        .setMessage(
            String.format(
                "This method overrides %s, which is annotated with @%s, but does not call the "
                    + "super method",
                annotatedSuperMethod, matchedAnnotationSimpleName))
        .build();
  }
1000149
@Override
  public Method getMethod(String methodName, int parameterCount) {
    for (Method method : methods) {
      if (method.getName().equals(methodName) && method.getParameters().size() == parameterCount) {
        return method;
      }
    }
    if (extending != null) {
      return extending.getMethod(methodName, parameterCount);
    }
    return null;
  }
572972
private static boolean hasMethod(JavaClass c, Method candidateMethod) {
		String name = candidateMethod.getName();
		String sig = candidateMethod.getSignature();

		for (Method method : c.getMethods()) {
			if (!method.isStatic() && method.getName().equals(name) && method.getSignature().equals(sig)) {
				return true;
			}
		}

		return false;
	}
146916
public void buildMethodComments(XMLNode node, Content methodDocTree) {
        if (!configuration.nocomment) {
            MethodDoc method = (MethodDoc) methods.get(currentMethodIndex);

            if (method.inlineTags().length == 0) {
                DocFinder.Output docs = DocFinder.search(configuration,
                        new DocFinder.Input(method));
                method = docs.inlineTags != null && docs.inlineTags.length > 0 ?
                    (MethodDoc) docs.holder : method;
            }
            //NOTE:  When we fix the bug where ClassDoc.interfaceTypes() does
            //       not pass all implemented interfaces, holder will be the
            //       interface type.  For now, it is really the erasure.
            writer.addComments(method.containingClass(), method, methodDocTree);
        }
    }
530087
private static void doCheck(SqlFragmentContainer statement, HashMap<String, ParameterDeclaration> paramMap,
                         final MethodDeclaration method)
    {

        SqlFragment[] fragments = statement.getChildren();
        for (SqlFragment fragment : fragments) {

            // if the fragment is a container check all of its children.
            if (fragment instanceof SqlFragmentContainer) {
                doCheck((SqlFragmentContainer) fragment, paramMap, method);

                // reflection fragment - make sure it can be mapped using the method's param values.
            } else if (fragment instanceof ReflectionFragment) {
                checkReflectionFragment((ReflectionFragment) fragment, paramMap, method);
            }
        }
    }
922407
static boolean isSetterMethod(final Method method) {
        return method.getName().startsWith(SETTER_METHOD_PREFIX)
                &&
                Builder.class.isAssignableFrom(method.getReturnType())
                &&
                !method.isVarArgs()
                &&
                method.getParameterTypes().length == 1;
    }
1182717
public static MethodDoc findMethod(ClassDoc cd, MethodDoc method) {
        MethodDoc[] methods = cd.methods();
        for (int i = 0; i < methods.length; i++) {
            if (executableMembersEqual(method, methods[i])) {
                return methods[i];

            }
        }
        return null;
    }
1093959
def overrides(method):
    '''
    
    '''
    def wrapper(func):
        if func.__name__ != method.__name__:
            msg = "Wrong @override: %r expected, but overwriting %r."
            msg = msg % (func.__name__, method.__name__)
            raise AssertionError(msg)

        if func.__doc__ is None:
            func.__doc__ = method.__doc__

        return func

    return wrapper
224512
private static void removeMethodByName(Method method, List<Method> methods) {
    if(methods != null) {
      Iterator<Method> itr = methods.iterator();
      Method aMethod = null;
      while(itr.hasNext()) {
        aMethod = itr.next();
        if(aMethod.getName().equals(method.getName())) {
          itr.remove();
          break;
        }
      }
      if(aMethod != null) {
        methods.add(aMethod);
      }
    }
  }
1053558
protected void checkProducerMethod(EnhancedAnnotatedMethod<T, ? super X> method) {
        if (method.getEnhancedParameters(Observes.class).size() > 0) {
            throw BeanLogger.LOG.inconsistentAnnotationsOnMethod(PRODUCER_ANNOTATION, "@Observes", this.method,
                    Formats.formatAsStackTraceElement(method.getJavaMember()));
        } else if (method.getEnhancedParameters(ObservesAsync.class).size() > 0) {
            throw BeanLogger.LOG.inconsistentAnnotationsOnMethod(PRODUCER_ANNOTATION, "@ObservesAsync", this.method,
                    Formats.formatAsStackTraceElement(method.getJavaMember()));
        } else if (method.getEnhancedParameters(Disposes.class).size() > 0) {
            throw BeanLogger.LOG.inconsistentAnnotationsOnMethod(PRODUCER_ANNOTATION, "@Disposes", this.method,
                    Formats.formatAsStackTraceElement(method.getJavaMember()));
        } else if (getDeclaringBean() instanceof SessionBean<?> && !Modifier.isStatic(method.slim().getJavaMember().getModifiers())) {
            boolean methodDeclaredOnTypes = false;
            for (Type type : getDeclaringBean().getTypes()) {
                Class<?> clazz = Reflections.getRawType(type);
                try {
                    AccessController.doPrivileged(new GetMethodAction(clazz, method.getName(), method.getParameterTypesAsArray()));
                    methodDeclaredOnTypes = true;
                    break;
                } catch (PrivilegedActionException ignored) {
                }
            }
            if (!methodDeclaredOnTypes) {
                throw BeanLogger.LOG.methodNotBusinessMethod("Producer", this, getDeclaringBean(), Formats.formatAsStackTraceElement(method.getJavaMember()));
            }
        }
    }