int (@Nullable PsiMethod method, @Nullable PsiClass containingClass, boolean checkBases) { if (method == null) { return -1; } final String methodName = method.getName(); if (containingClass == null) { containingClass = method.getContainingClass(); } if (containingClass == null) { return -1; } for (int i = 0, size = myMethodNamePatterns.size(); i < size; i++) { final Pattern pattern = getPattern(i); if (pattern == null || !pattern.matcher(methodName).matches()) { continue; } final String className = myClassNames.get(i); final PsiClass base = JavaPsiFacade.getInstance(method.getProject()).findClass(className, containingClass.getResolveScope()); if (InheritanceUtil.isInheritorOrSelf(containingClass, base, true)) { if (base.findMethodsBySignature(method, checkBases).length > 0) { // is method present in base class and not introduced in some subclass return i; } } } return -1; }