private boolean isNullCheck(@Nullable LighterASTNode expr, LighterASTNode var, boolean negated) {
    expr = skipParenthesesCastsDown(tree, expr);
    if (expr == null || isAssignedInside(expr, var)) return false;

    IElementType type = expr.getTokenType();
    if (type == BINARY_EXPRESSION || type == POLYADIC_EXPRESSION) {
      List<LighterASTNode> operands = getExpressionChildren(tree, expr);
      if (firstChildOfType(tree, expr, negated ? JavaTokenType.EQEQ : JavaTokenType.NE) != null) {
        return operands.size() == 2 && isNullLiteralExpression(tree, operands.get(1)) && isReferenceToLocal(operands.get(0), var);
      }

      if (firstChildOfType(tree, expr, negated ? JavaTokenType.OROR : JavaTokenType.ANDAND) == null) return false;
      for (LighterASTNode t : operands) {
        if (isNullCheck(t, var, negated)) return true;
      }
      return false;
    }
    if (type == PREFIX_EXPRESSION && firstChildOfType(tree, expr, JavaTokenType.EXCL) != null) {
      return isNullCheck(findExpressionChild(tree, expr), var, !negated);
    }

    return !negated && type == INSTANCE_OF_EXPRESSION && isReferenceToLocal(findExpressionChild(tree, expr), var);
  }
private boolean isNullCheck(@Nullable LighterASTNode expr, LighterASTNode var, boolean negated)