langtools/src/share/classes/com/sun/tools/javac/util/Log.java
changeset 6143 79b7dee406cc
parent 5850 6f095ff5b469
child 6582 c7a4fb5a2f86
equal deleted inserted replaced
6032:03b276d8e6a6 6143:79b7dee406cc
   267 
   267 
   268     /** Prompt user after an error.
   268     /** Prompt user after an error.
   269      */
   269      */
   270     public void prompt() {
   270     public void prompt() {
   271         if (promptOnError) {
   271         if (promptOnError) {
   272             System.err.println(getLocalizedString("resume.abort"));
   272             System.err.println(localize("resume.abort"));
   273             char ch;
   273             char ch;
   274             try {
   274             try {
   275                 while (true) {
   275                 while (true) {
   276                     switch (System.in.read()) {
   276                     switch (System.in.read()) {
   277                     case 'a': case 'A':
   277                     case 'a': case 'A':
   315             msg = msg.substring(nl+1);
   315             msg = msg.substring(nl+1);
   316         }
   316         }
   317         if (msg.length() != 0) writer.println(msg);
   317         if (msg.length() != 0) writer.println(msg);
   318     }
   318     }
   319 
   319 
       
   320     /** Print the text of a message to the errWriter stream,
       
   321      *  translating newlines appropriately for the platform.
       
   322      */
       
   323     public void printErrLines(String key, Object... args) {
       
   324         printLines(errWriter, localize(key, args));
       
   325     }
       
   326 
       
   327 
       
   328     /** Print the text of a message to the noticeWriter stream,
       
   329      *  translating newlines appropriately for the platform.
       
   330      */
       
   331     public void printNoteLines(String key, Object... args) {
       
   332         printLines(noticeWriter, localize(key, args));
       
   333     }
       
   334 
   320     protected void directError(String key, Object... args) {
   335     protected void directError(String key, Object... args) {
   321         printLines(errWriter, getLocalizedString(key, args));
   336         printErrLines(key, args);
   322         errWriter.flush();
   337         errWriter.flush();
   323     }
   338     }
   324 
   339 
   325     /** Report a warning that cannot be suppressed.
   340     /** Report a warning that cannot be suppressed.
   326      *  @param pos    The source position at which to report the warning.
   341      *  @param pos    The source position at which to report the warning.
   424             throw new Error();
   439             throw new Error();
   425         }
   440         }
   426     }
   441     }
   427 
   442 
   428     /** Find a localized string in the resource bundle.
   443     /** Find a localized string in the resource bundle.
       
   444      *  Because this method is static, it ignores the locale.
       
   445      *  Use localize(key, args) when possible.
   429      *  @param key    The key for the localized string.
   446      *  @param key    The key for the localized string.
   430      *  @param args   Fields to substitute into the string.
   447      *  @param args   Fields to substitute into the string.
   431      */
   448      */
   432     public static String getLocalizedString(String key, Object ... args) {
   449     public static String getLocalizedString(String key, Object ... args) {
   433         return JavacMessages.getDefaultLocalizedString("compiler.misc." + key, args);
   450         return JavacMessages.getDefaultLocalizedString("compiler.misc." + key, args);
       
   451     }
       
   452 
       
   453     /** Find a localized string in the resource bundle.
       
   454      *  @param key    The key for the localized string.
       
   455      *  @param args   Fields to substitute into the string.
       
   456      */
       
   457     public String localize(String key, Object... args) {
       
   458         return messages.getLocalizedString("compiler.misc." + key, args);
   434     }
   459     }
   435 
   460 
   436 /***************************************************************************
   461 /***************************************************************************
   437  * raw error messages without internationalization; used for experimentation
   462  * raw error messages without internationalization; used for experimentation
   438  * and quick prototyping
   463  * and quick prototyping