@Override
  @NotNull
  public TextBuffer toJava(int indent, @NotNull BytecodeMappingTracer tracer) {
    SwitchHelper.simplifySwitchOnEnum(this);
    TextBuffer buf = new TextBuffer();
    buf.append(ExprProcessor.listToJava(varDefinitions, indent, tracer));
    buf.append(first.toJava(indent, tracer));
    if (isLabeled()) {
      buf.appendIndent(indent).append("label").append(Integer.toString(id)).append(":").appendLineSeparator();
      tracer.incrementCurrentSourceLine();
    }
    buf.appendIndent(indent).append(headExprent.toJava(indent, tracer)).append(" {").appendLineSeparator();
    tracer.incrementCurrentSourceLine();
    VarType switchType = headExprent.getExprType();
    for (int i = 0; i < caseStatements.size(); i++) {
      Statement stat = caseStatements.get(i);
      List<StatEdge> edges = caseEdges.get(i);
      List<Exprent> values = caseValues.get(i);
      for (int j = 0; j < edges.size(); j++) {
        if (edges.get(j) == defaultEdge && !useCustomDefault) {
          if (!canBeRule) {
            buf.appendIndent(indent + 1).append("default:").appendLineSeparator();
          }
          else {
            buf.appendIndent(indent + 1).append("default -> ");
          }
        }
        else {
          buf.appendIndent(indent + 1).append("case ");
          Exprent value = values.get(j);
          if (value instanceof ConstExprent constExprent && !constExprent.isNull()) {
            value = value.copy();
            if (switchType.getType() != TYPE_OBJECT) {
              ((ConstExprent)value).setConstType(switchType);
            }
            else if (((JAVA_LANG_CHARACTER).equals(switchType.getValue()))) {
              ((ConstExprent)value).setConstType(VARTYPE_CHAR);
            }
          }
          if (value instanceof FieldExprent && ((FieldExprent)value).isStatic()) { // enum values
            buf.append(((FieldExprent)value).getName());
          }
          else {
            buf.append(value.toJava(indent, tracer));
          }

          Exprent guard = guards.get(stat);
          if (guard != null) {
            buf.append(" when ").append(guard.toJava(0, tracer));
          }

          if (!canBeRule) {
            buf.append(":").appendLineSeparator();
          }
          else {
            buf.append(" -> ");
          }
        }
        if (!canBeRule) {
          tracer.incrementCurrentSourceLine();
        }
      }
      //example:
      //case 0: break
      if (canBeRule && stat instanceof BasicBlockStatement blockStatement && blockStatement.getBlock().getSeq().isEmpty() &&
          (stat.getExprents() == null || stat.getExprents().isEmpty())) {
        buf.append("{ }").appendLineSeparator();
        tracer.incrementCurrentSourceLine();
      }
      else {
        if (canBeRule && stat instanceof BasicBlockStatement blockStatement && blockStatement.getExprents() != null &&
            (blockStatement.getExprents().size() > 1 ||
             (blockStatement.getExprents().size() == 1 &&
              blockStatement.getExprents().get(0) instanceof ExitExprent exitExprent &&
              exitExprent.getExitType() == ExitExprent.EXIT_RETURN))) {
          TextBuffer buffer = ExprProcessor.jmpWrapper(stat, indent + 2, false, tracer);
          buf.append("{").appendLineSeparator();
          tracer.incrementCurrentSourceLine();
          buf.append(buffer).appendIndent(indent + 1).append("}").appendLineSeparator();
          tracer.incrementCurrentSourceLine();
        }
        else {
          TextBuffer buffer = ExprProcessor.jmpWrapper(stat, canBeRule ? 0 : indent + 2, false, tracer);
          buf.append(buffer);
        }
      }
    }
    buf.appendIndent(indent).append("}").appendLineSeparator();
    tracer.incrementCurrentSourceLine();
    return buf;
  }
@Override
  @NotNull
  public TextBuffer toJava(int indent, @NotNull BytecodeMappingTracer tracer)