Exemplo n.º 1
0
  private void report(DiagnosticType type, SourcePosition pos, String msg) {
    switch (type) {
      case ERROR:
      case WARNING:
        Object prefix = (pos == null) ? programName : pos;
        report(javadocDiags.create(type, null, null, "msg", prefix, msg));
        break;

      case NOTE:
        String key = (pos == null) ? "msg" : "pos.msg";
        report(javadocDiags.create(type, null, null, key, pos, msg));
        break;

      default:
        throw new IllegalArgumentException(type.toString());
    }
  }
Exemplo n.º 2
0
  /**
   * Print a message. Part of DocErrorReporter.
   *
   * @param pos the position where the error occurs
   * @param msg message to print
   */
  public void printNotice(SourcePosition pos, String msg) {
    if (diagListener != null) {
      report(DiagnosticType.NOTE, pos, msg);
      return;
    }

    if (pos == null) noticeWriter.println(msg);
    else noticeWriter.println(pos + ": " + msg);
    noticeWriter.flush();
  }
Exemplo n.º 3
0
  /**
   * Print warning message, increment warning count. Part of DocErrorReporter.
   *
   * @param pos the position where the error occurs
   * @param msg message to print
   */
  public void printWarning(SourcePosition pos, String msg) {
    if (diagListener != null) {
      report(DiagnosticType.WARNING, pos, msg);
      return;
    }

    if (nwarnings < MaxWarnings) {
      String prefix = (pos == null) ? programName : pos.toString();
      warnWriter.println(prefix + ": " + getText("javadoc.warning") + " - " + msg);
      warnWriter.flush();
      nwarnings++;
    }
  }
Exemplo n.º 4
0
  /**
   * Print error message, increment error count. Part of DocErrorReporter.
   *
   * @param pos the position where the error occurs
   * @param msg message to print
   */
  public void printError(SourcePosition pos, String msg) {
    if (diagListener != null) {
      report(DiagnosticType.ERROR, pos, msg);
      return;
    }

    if (nerrors < MaxErrors) {
      String prefix = (pos == null) ? programName : pos.toString();
      errWriter.println(prefix + ": " + getText("javadoc.error") + " - " + msg);
      errWriter.flush();
      prompt();
      nerrors++;
    }
  }