void (PsiLambdaExpression lambda, PsiParameter parameter, PsiExpression expression) { if (!BoolUtils.isNegation(expression)) return; PsiMethodCallExpression negated = ObjectUtils.tryCast(BoolUtils.getNegated(expression), PsiMethodCallExpression.class); if (!PREDICATE_TEST.test(negated)) return; if (!ExpressionUtils.isReferenceTo(negated.getArgumentList().getExpressions()[0], parameter)) return; PsiExpression qualifier = negated.getMethodExpression().getQualifierExpression(); if (!ExpressionUtils.isSafelyRecomputableExpression(qualifier) || ExpressionUtils.isReferenceTo(qualifier, parameter)) return; PsiType lambdaType = ExpectedTypeUtils.findExpectedType(lambda, false); if (lambdaType == null || qualifier.getType() == null || !lambdaType.isAssignableFrom(qualifier.getType())) return; registerProblem(lambda, "Pattern.negate()", ParenthesesUtils.getText(qualifier, PsiPrecedenceUtil.METHOD_CALL_PRECEDENCE) + ".negate()"); }