Example #1
0
  /**
   * Returns a multi line message that includes the manifest extract that gave
   *
   * <p>rise to the problem.
   *
   * @return a multi line string
   */
  public String toStringWithContext() {

    int relevantLine = context.getLine(startoffset);

    String relevantLineData = context.getLineAsString(relevantLine);

    String theMessage =
        problemKind.format(context.getLine(startoffset), context.getColumn(startoffset), inserts);

    StringBuilder beautifulMessage = new StringBuilder();

    beautifulMessage.append(relevantLineData);

    int scol = context.getColumn(startoffset);

    int ecol = context.getColumn(endoffset);

    int where = 0;

    for (where = 0; where < scol; where++) {

      beautifulMessage.append(' ');
    }

    beautifulMessage.append('^');

    if (ecol != scol) {

      where++;

      for (; where < ecol; where++) {

        beautifulMessage.append(' ');
      }

      beautifulMessage.append('^');
    }

    beautifulMessage.append('\n');

    beautifulMessage.append(theMessage);

    return beautifulMessage.toString();
  }
Example #2
0
  @Override
  public String toString() {

    return problemKind.format(
        context.getLine(startoffset), context.getColumn(startoffset), inserts);
  }