src/share/classes/com/sun/tools/javac/util/Log.java

changeset 136
8eafba4f61be
parent 100
37551dc0f591
child 137
e4eaddca54b7
     1.1 --- a/src/share/classes/com/sun/tools/javac/util/Log.java	Thu Oct 09 16:04:29 2008 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/util/Log.java	Thu Oct 09 16:07:38 2008 +0100
     1.3 @@ -29,7 +29,6 @@
     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 @@ -97,6 +96,11 @@
    1.12       */
    1.13      private DiagnosticFormatter<JCDiagnostic> diagFormatter;
    1.14  
    1.15 +    /**
    1.16 +     * JavacMessages object used for localization
    1.17 +     */
    1.18 +    private JavacMessages messages;
    1.19 +
    1.20      /** Construct a log with given I/O redirections.
    1.21       */
    1.22      @Deprecated
    1.23 @@ -115,9 +119,9 @@
    1.24          this.MaxWarnings = getIntOption(options, "-Xmaxwarns", 100);
    1.25  
    1.26          boolean rawDiagnostics = options.get("rawDiagnostics") != null;
    1.27 -        Messages msgs = Messages.instance(context);
    1.28 -        this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(msgs) :
    1.29 -                                              new BasicDiagnosticFormatter(options, msgs);
    1.30 +        messages = JavacMessages.instance(context);
    1.31 +        this.diagFormatter = rawDiagnostics ? new RawDiagnosticFormatter(messages) :
    1.32 +                                              new BasicDiagnosticFormatter(options, messages);
    1.33          @SuppressWarnings("unchecked") // FIXME
    1.34          DiagnosticListener<? super JavaFileObject> diagListener =
    1.35              context.get(DiagnosticListener.class);
    1.36 @@ -335,7 +339,7 @@
    1.37  
    1.38          PrintWriter writer = getWriterForDiagnosticType(diag.getType());
    1.39  
    1.40 -        printLines(writer, diagFormatter.format(diag, Locale.getDefault()));
    1.41 +        printLines(writer, diagFormatter.format(diag, messages.getCurrentLocale()));
    1.42          if (diagFormatter.displaySource(diag)) {
    1.43              int pos = diag.getIntPosition();
    1.44              if (pos != Position.NOPOS) {
    1.45 @@ -384,7 +388,7 @@
    1.46       *  @param args   Fields to substitute into the string.
    1.47       */
    1.48      public static String getLocalizedString(String key, Object ... args) {
    1.49 -        return Messages.getDefaultLocalizedString("compiler.misc." + key, args);
    1.50 +        return JavacMessages.getDefaultLocalizedString("compiler.misc." + key, args);
    1.51      }
    1.52  
    1.53  /***************************************************************************

mercurial