PsiElement (@NotNull String name, @NotNull ReflectiveClass ownerClass, Predicate<? super PsiMethod> filter) { PsiMethod[] methods = ownerClass.getPsiClass().findMethodsByName(name, true); if (methods.length != 0) { methods = ContainerUtil.filter(methods, filter::test).toArray(PsiMethod.EMPTY_ARRAY); if (methods.length > 1) { final PsiMethodCallExpression definitionCall = PsiTreeUtil.getParentOfType(myElement, PsiMethodCallExpression.class); if (definitionCall != null) { final PsiExpression[] arguments = definitionCall.getArgumentList().getExpressions(); if (arguments.length > 2) { final PsiExpression typeExpression = PsiUtil.skipParenthesizedExprDown(arguments[2]); final ReflectiveSignature expectedSignature = composeMethodSignature(typeExpression); if (expectedSignature != null) { return ContainerUtil.find(methods, method -> expectedSignature.equals(getMethodSignature(method))); } } } } } return methods.length != 0 ? methods[0] : null; }