private void check(PsiParameterListOwner owner, boolean compareTo) {
      PsiParameterList parameterList = owner.getParameterList();
      PsiElement body = owner.getBody();
      int expectedParameters = compareTo ? 1 : 2;
      if (body == null || parameterList.getParametersCount() != expectedParameters) return;
      // comparator like "(a, b) -> 0" fulfills the comparator contract, so no need to warn its parameters are not used
      if (body instanceof PsiExpression && ExpressionUtils.isZero((PsiExpression)body)) return;
      if (body instanceof PsiCodeBlock) {
        PsiStatement statement = ControlFlowUtils.getOnlyStatementInBlock((PsiCodeBlock)body);
        if (statement instanceof PsiReturnStatement && ExpressionUtils.isZero(((PsiReturnStatement)statement).getReturnValue())) return;
      }
      PsiMethodCallExpression soleCall = ObjectUtils.tryCast(LambdaUtil.extractSingleExpressionFromBody(body), PsiMethodCallExpression.class);
      if (soleCall != null) {
        MethodContract contract = ContainerUtil.getOnlyItem(JavaMethodContractUtil.getMethodCallContracts(soleCall));
        if (contract != null && contract.isTrivial() && contract.getReturnValue().isFail()) return;
      }
      PsiParameter[] parameters = parameterList.getParameters();
      checkParameterList(parameters, body, compareTo ? "compareTo" : "compare");
      checkReturnValueSanity(owner instanceof PsiMethod method ? method.getNameIdentifier() : parameterList, body);
      checkReflexivity(owner, parameters, body);
      checkReturnMinValue(body);
    }
private void check(PsiParameterListOwner owner, boolean compareTo)