StreamFilterNotNullFix (PsiElement reference) { PsiFunctionalExpression fn = findFunction(reference); if (fn == null) return null; PsiExpressionList args = tryCast(PsiUtil.skipParenthesizedExprUp(fn.getParent()), PsiExpressionList.class); if (args == null || args.getExpressionCount() != 1) return null; PsiMethodCallExpression call = tryCast(args.getParent(), PsiMethodCallExpression.class); if (call == null) return null; PsiExpression qualifier = call.getMethodExpression().getQualifierExpression(); if (qualifier == null || !InheritanceUtil.isInheritor(qualifier.getType(), CommonClassNames.JAVA_UTIL_STREAM_STREAM)) return null; return new StreamFilterNotNullFix(); }