PsiMethod (PsiType type) { Ref<PsiMethod> refMethod = Ref.create(); InheritanceUtil.processSuperTypes(type, true, superType -> { if (!(superType instanceof PsiClassType)) return true; PsiClassType.ClassResolveResult result = ((PsiClassType)superType).resolveGenerics(); PsiClass superClass = result.getElement(); if (superClass == null) return true; if (!CommonClassNames.JAVA_LANG_STRING_TEMPLATE_PROCESSOR.equals(superClass.getQualifiedName())) return true; PsiMethod[] processMethods = superClass.findMethodsByName("process", false); for (PsiMethod method : processMethods) { PsiParameter[] parameters = method.getParameterList().getParameters(); if (parameters.length == 1) { PsiType parameterType = parameters[0].getType(); if (parameterType instanceof PsiClassType && parameterType.equalsToText(CommonClassNames.JAVA_LANG_STRING_TEMPLATE)) { refMethod.set(method); return false; } } } return true; }); return refMethod.get(); }