public static BuilderMessage createCompileMessage(final BuildMessage.Kind kind,
                                                    @Nls(capitalization = Nls.Capitalization.Sentence) String text,
                                                    String path,
                                                    long beginOffset, long endOffset, long offset, long line,
                                                    long column, float done, Collection<String> moduleNames) {

    final BuilderMessage.CompileMessage.Builder builder = BuilderMessage.CompileMessage.newBuilder();
    switch (kind) {
      case ERROR:
        builder.setKind(BuilderMessage.CompileMessage.Kind.ERROR);
        break;
      case WARNING:
        builder.setKind(BuilderMessage.CompileMessage.Kind.WARNING);
        break;
      case INFO:
        builder.setKind(BuilderMessage.CompileMessage.Kind.INFO);
        break;
      case JPS_INFO:
        builder.setKind(BuilderMessage.CompileMessage.Kind.JPS_INFO);
        break;
      case INTERNAL_BUILDER_ERROR:
        builder.setKind(BuilderMessage.CompileMessage.Kind.INTERNAL_BUILDER_ERROR);
        break;
      case OTHER:
        builder.setKind(BuilderMessage.CompileMessage.Kind.OTHER);
        break;
      default:
        builder.setKind(BuilderMessage.CompileMessage.Kind.PROGRESS);
    }
    if (text != null) {
      builder.setText(text);
    }
    if (path != null) {
      builder.setSourceFilePath(path);
    }
    if (beginOffset >= 0L) {
      builder.setProblemBeginOffset(beginOffset);
    }
    if (endOffset >= 0L) {
      builder.setProblemEndOffset(endOffset);
    }
    if (offset >= 0L) {
      builder.setProblemLocationOffset(offset);
    }
    if (line >= 0L) {
      builder.setLine(line);
    }
    if (column >= 0L) {
      builder.setColumn(column);
    }
    if (done >= 0.0f) {
      builder.setDone(done);
    }
    if (!moduleNames.isEmpty()) {
      builder.addAllModuleNames(moduleNames);
    }
    return BuilderMessage.newBuilder().setType(BuilderMessage.Type.COMPILE_MESSAGE).setCompileMessage(builder.build()).build();
  }
public static BuilderMessage createCompileMessage(final BuildMessage.Kind kind,
                                                    @Nls(capitalization = Nls.Capitalization.Sentence) String text,
                                                    String path,
                                                    long beginOffset, long endOffset, long offset, long line,
                                                    long column, float done, Collection<String> moduleNames)