private static boolean shouldReportZero(PsiExpression ref) {
    if (ref instanceof PsiPolyadicExpression polyadic) {
      if (PsiUtil.isConstantExpression(ref)) return false;
      IElementType tokenType = polyadic.getOperationTokenType();
      if (tokenType.equals(JavaTokenType.ASTERISK)) {
        PsiMethod method = PsiTreeUtil.getParentOfType(ref, PsiMethod.class, true, PsiLambdaExpression.class, PsiClass.class);
        if (MethodUtils.isHashCode(method)) {
          // Standard hashCode template generates int result = 0; result = result * 31 + ...;
          // so annoying warnings might be produced there
          return false;
        }
      }
    }
    else if (ref instanceof PsiMethodCallExpression call) {
      PsiExpression qualifier = call.getMethodExpression().getQualifierExpression();
      if (PsiUtil.isConstantExpression(qualifier) &&
          ContainerUtil.and(call.getArgumentList().getExpressions(), PsiUtil::isConstantExpression)) {
        return false;
      }
    }
    else if (ref instanceof PsiTypeCastExpression) {
      PsiExpression operand = ((PsiTypeCastExpression)ref).getOperand();
      return operand != null && TypeConversionUtil.isFloatOrDoubleType(operand.getType());
    }
    else {
      return false;
    }
    PsiElement parent = PsiUtil.skipParenthesizedExprUp(ref.getParent());
    PsiBinaryExpression binOp = tryCast(parent, PsiBinaryExpression.class);
    return binOp == null || !ComparisonUtils.isEqualityComparison(binOp) ||
           (!ExpressionUtils.isZero(binOp.getLOperand()) && !ExpressionUtils.isZero(binOp.getROperand()));
  }
private static boolean shouldReportZero(PsiExpression ref)