changeset 1472 | 1e09e143438c |
parent 1471 | 57506cdfb7b4 |
child 1870 | 57a1138dffc8 |
--- a/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Thu Oct 09 16:07:38 2008 +0100 +++ b/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java Thu Oct 09 16:19:13 2008 +0100 @@ -62,7 +62,8 @@ * @param msgs JavacMessages object used for i18n */ BasicDiagnosticFormatter(Options opts, JavacMessages msgs) { - this(msgs); //common init + super(msgs, opts, true); + initAvailableFormats(); String fmt = opts.get("diags"); if (fmt != null) { String[] formats = fmt.split("\\|"); @@ -83,7 +84,11 @@ * @param msgs JavacMessages object used for i18n */ public BasicDiagnosticFormatter(JavacMessages msgs) { - super(msgs); + super(msgs, true); + initAvailableFormats(); + } + + public void initAvailableFormats() { availableFormats = new HashMap<BasicFormatKind, String>(); availableFormats.put(DEFAULT_POS_FORMAT, "%f:%l:%_%t%m"); availableFormats.put(DEFAULT_NO_POS_FORMAT, "%p%m"); @@ -104,6 +109,9 @@ } buf.append(meta ? formatMeta(c, d, l) : String.valueOf(c)); } + if (displaySource(d)) { + buf.append("\n" + formatSourceLine(d)); + } return buf.toString(); } @@ -167,10 +175,6 @@ return format; } - public boolean displaySource(JCDiagnostic d) { - return true; - } - /** * This enum contains all the kinds of formatting patterns supported * by a basic diagnostic formatter.