52 DiagnosticPart.DETAILS, |
52 DiagnosticPart.DETAILS, |
53 DiagnosticPart.SUBDIAGNOSTICS))); |
53 DiagnosticPart.SUBDIAGNOSTICS))); |
54 } |
54 } |
55 |
55 |
56 //provide common default formats |
56 //provide common default formats |
57 public String format(JCDiagnostic d, Locale l) { |
57 public String formatDiagnostic(JCDiagnostic d, Locale l) { |
58 try { |
58 try { |
59 StringBuffer buf = new StringBuffer(); |
59 StringBuffer buf = new StringBuffer(); |
60 if (d.getPosition() != Position.NOPOS) { |
60 if (d.getPosition() != Position.NOPOS) { |
61 buf.append(formatSource(d, false, null)); |
61 buf.append(formatSource(d, false, null)); |
62 buf.append(':'); |
62 buf.append(':'); |
80 } |
80 } |
81 |
81 |
82 public String formatMessage(JCDiagnostic d, Locale l) { |
82 public String formatMessage(JCDiagnostic d, Locale l) { |
83 StringBuilder buf = new StringBuilder(); |
83 StringBuilder buf = new StringBuilder(); |
84 Collection<String> args = formatArguments(d, l); |
84 Collection<String> args = formatArguments(d, l); |
85 buf.append(d.getCode()); |
85 buf.append(localize(null, d.getCode(), args.toArray())); |
86 String sep = ": "; |
|
87 for (Object o : args) { |
|
88 buf.append(sep); |
|
89 buf.append(o); |
|
90 sep = ", "; |
|
91 } |
|
92 if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) { |
86 if (d.isMultiline() && getConfiguration().getVisible().contains(DiagnosticPart.SUBDIAGNOSTICS)) { |
93 List<String> subDiags = formatSubdiagnostics(d, null); |
87 List<String> subDiags = formatSubdiagnostics(d, null); |
94 if (subDiags.nonEmpty()) { |
88 if (subDiags.nonEmpty()) { |
95 sep = ""; |
89 String sep = ""; |
96 buf.append(",{"); |
90 buf.append(",{"); |
97 for (String sub : formatSubdiagnostics(d, null)) { |
91 for (String sub : formatSubdiagnostics(d, null)) { |
98 buf.append(sep); |
92 buf.append(sep); |
99 buf.append("(" + sub + ")"); |
93 buf.append("(" + sub + ")"); |
100 sep = ","; |
94 sep = ","; |