1.1 --- a/src/share/classes/com/sun/tools/javac/util/Log.java Fri Jul 25 12:22:09 2008 +0100 1.2 +++ b/src/share/classes/com/sun/tools/javac/util/Log.java Mon Jul 28 10:22:10 2008 +0100 1.3 @@ -29,11 +29,13 @@ 1.4 import java.util.HashSet; 1.5 import java.util.Map; 1.6 import java.util.Set; 1.7 +import java.util.Locale; 1.8 import javax.tools.DiagnosticListener; 1.9 import javax.tools.JavaFileObject; 1.10 1.11 import com.sun.tools.javac.file.JavacFileManager; 1.12 import com.sun.tools.javac.tree.JCTree; 1.13 +import com.sun.tools.javac.api.DiagnosticFormatter; 1.14 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; 1.15 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; 1.16 1.17 @@ -68,10 +70,6 @@ 1.18 public final int MaxErrors; 1.19 public final int MaxWarnings; 1.20 1.21 - /** Whether or not to display the line of source containing a diagnostic. 1.22 - */ 1.23 - private final boolean showSourceLine; 1.24 - 1.25 /** Switch: prompt user on each error. 1.26 */ 1.27 public boolean promptOnError; 1.28 @@ -97,7 +95,7 @@ 1.29 /** 1.30 * Formatter for diagnostics 1.31 */ 1.32 - private DiagnosticFormatter diagFormatter; 1.33 + private DiagnosticFormatter<JCDiagnostic> diagFormatter; 1.34 1.35 /** Construct a log with given I/O redirections. 1.36 */ 1.37 @@ -115,9 +113,11 @@ 1.38 this.emitWarnings = options.get("-Xlint:none") == null; 1.39 this.MaxErrors = getIntOption(options, "-Xmaxerrs", 100); 1.40 this.MaxWarnings = getIntOption(options, "-Xmaxwarns", 100); 1.41 - this.showSourceLine = options.get("rawDiagnostics") == null; 1.42 1.43 - this.diagFormatter = DiagnosticFormatter.instance(context); 1.44 + boolean rawDiagnostics = options.get("rawDiagnostics") != null; 1.45 + Messages msgs = Messages.instance(context); 1.46 + this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(msgs) : 1.47 + new BasicDiagnosticFormatter(options, msgs); 1.48 @SuppressWarnings("unchecked") // FIXME 1.49 DiagnosticListener<? super JavaFileObject> diagListener = 1.50 context.get(DiagnosticListener.class); 1.51 @@ -335,8 +335,8 @@ 1.52 1.53 PrintWriter writer = getWriterForDiagnosticType(diag.getType()); 1.54 1.55 - printLines(writer, diagFormatter.format(diag)); 1.56 - if (showSourceLine) { 1.57 + printLines(writer, diagFormatter.format(diag, Locale.getDefault())); 1.58 + if (diagFormatter.displaySource(diag)) { 1.59 int pos = diag.getIntPosition(); 1.60 if (pos != Position.NOPOS) { 1.61 JavaFileObject prev = useSource(diag.getSource());