private static boolean searchForClass(Exprent exprent, VarType classType) {
    List<Exprent> lst = exprent.getAllExprents(true);
    lst.add(exprent);

    String classname = classType.getValue();

    for (Exprent expr : lst) {
      boolean res = false;

      switch (expr.type) {
        case Exprent.EXPRENT_CONST -> {
          ConstExprent constExpr = (ConstExprent)expr;
          res = (VarType.VARTYPE_CLASS.equals(constExpr.getConstType()) && classname.equals(constExpr.getValue()) ||
                 classType.equals(constExpr.getConstType()));
        }
        case Exprent.EXPRENT_FIELD -> res = classname.equals(((FieldExprent)expr).getClassname());
        case Exprent.EXPRENT_INVOCATION -> res = classname.equals(((InvocationExprent)expr).getClassName());
        case Exprent.EXPRENT_NEW -> {
          VarType newType = expr.getExprType();
          res = newType.getType() == CodeConstants.TYPE_OBJECT && classname.equals(newType.getValue());
        }
        case Exprent.EXPRENT_VAR -> {
          VarExprent varExpr = (VarExprent)expr;
          if (varExpr.isDefinition()) {
            VarType varType = varExpr.getVarType();
            if (classType.equals(varType) || (varType.getArrayDim() > 0 && classType.getValue().equals(varType.getValue()))) {
              res = true;
            }
          }
        }
      }

      if (res) {
        return true;
      }
    }

    return false;
  }
private static boolean searchForClass(Exprent exprent, VarType classType)