boolean (@NotNull PsiElement anchor, @NotNull ContractValue wantedConstraint) { PsiElement parent = PsiUtil.skipParenthesizedExprUp(anchor.getParent()); if (parent instanceof PsiExpressionList) { int index = ArrayUtil.indexOf(((PsiExpressionList)parent).getExpressions(), anchor); if (index >= 0) { PsiMethodCallExpression call = tryCast(parent.getParent(), PsiMethodCallExpression.class); if (call != null) { MethodContract contract = ContainerUtil.getOnlyItem(JavaMethodContractUtil.getMethodCallContracts(call)); if (contract != null && contract.getReturnValue().isFail()) { ContractValue condition = ContainerUtil.getOnlyItem(contract.getConditions()); if (condition != null) { return condition.getArgumentComparedTo(wantedConstraint, false).orElse(-1) == index; } } } } } return false; }