Class Messager

  • All Implemented Interfaces:
    DocErrorReporter

    @Deprecated
    public class Messager
    extends com.sun.tools.javac.util.Log
    implements DocErrorReporter
    Deprecated.
    Utility for integrating with javadoc tools and for localization. Handle Resources. Access to error and warning counts. Message formatting.
    Also provides implementation for DocErrorReporter.

    This is NOT part of any supported API. If you write code that depends on this, you do so at your own risk. This code and its internal interfaces are subject to change or deletion without notice.

    See Also:
    ResourceBundle, MessageFormat
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  Messager.ExitJavadoc
      Deprecated.
       
      • Nested classes/interfaces inherited from class com.sun.tools.javac.util.Log

        com.sun.tools.javac.util.Log.DeferredDiagnosticHandler, com.sun.tools.javac.util.Log.DiagnosticHandler, com.sun.tools.javac.util.Log.DiscardDiagnosticHandler, com.sun.tools.javac.util.Log.PrefixKind, com.sun.tools.javac.util.Log.WriterKind
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) static java.io.PrintWriter defaultErrWriter
      Deprecated.
      The default writer for diagnostics
      (package private) static java.io.PrintWriter defaultNoticeWriter
      Deprecated.
       
      (package private) static java.io.PrintWriter defaultWarnWriter
      Deprecated.
       
      private com.sun.tools.javac.util.JCDiagnostic.Factory javadocDiags
      Deprecated.
       
      private java.util.Locale locale
      Deprecated.
       
      private com.sun.tools.javac.util.JavacMessages messages
      Deprecated.
       
      static SourcePosition NOPOS
      Deprecated.
       
      (package private) java.lang.String programName
      Deprecated.
       
      • Fields inherited from class com.sun.tools.javac.util.Log

        compressedOutput, diagListener, dumpOnError, emitWarnings, errKey, expectDiagKeys, logKey, MaxErrors, MaxWarnings, nerrors, nwarnings, outKey, promptOnError, recorded, recordedSourceLevelErrors, suppressNotes
      • Fields inherited from class com.sun.tools.javac.util.AbstractLog

        diags, source, sourceMap
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Messager​(com.sun.tools.javac.util.Context context, java.lang.String programName)
      Deprecated.
      Constructor
      protected Messager​(com.sun.tools.javac.util.Context context, java.lang.String programName, java.io.PrintWriter errWriter, java.io.PrintWriter warnWriter, java.io.PrintWriter noticeWriter)
      Deprecated.
      Constructor
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      void error​(SourcePosition pos, java.lang.String key, java.lang.Object... args)
      Deprecated.
      Print error message, increment error count.
      void exit()
      Deprecated.
      Force program exit, e.g., from a fatal error.
      void exitNotice()
      Deprecated.
      Print exit message.
      (package private) java.lang.String getText​(java.lang.String key, java.lang.Object... args)
      Deprecated.
      get and format message string from resource
      static Messager instance0​(com.sun.tools.javac.util.Context context)
      Deprecated.
      Get the current messager, which is also the compiler log.
      int nerrors()
      Deprecated.
      Return total number of errors, including those recorded in the compilation log.
      void notice​(java.lang.String key, java.lang.Object... args)
      Deprecated.
      Print a message.
      int nwarnings()
      Deprecated.
      Return total number of warnings, including those recorded in the compilation log.
      static void preRegister​(com.sun.tools.javac.util.Context context, java.lang.String programName)
      Deprecated.
       
      static void preRegister​(com.sun.tools.javac.util.Context context, java.lang.String programName, java.io.PrintWriter errWriter, java.io.PrintWriter warnWriter, java.io.PrintWriter noticeWriter)
      Deprecated.
       
      void printError​(SourcePosition pos, java.lang.String msg)
      Deprecated.
      Print error message, increment error count.
      void printError​(java.lang.String msg)
      Deprecated.
      Print error message, increment error count.
      void printNotice​(SourcePosition pos, java.lang.String msg)
      Deprecated.
      Print a message.
      void printNotice​(java.lang.String msg)
      Deprecated.
      Print a message.
      void printWarning​(SourcePosition pos, java.lang.String msg)
      Deprecated.
      Print warning message, increment warning count.
      void printWarning​(java.lang.String msg)
      Deprecated.
      Print warning message, increment warning count.
      private void report​(com.sun.tools.javac.util.JCDiagnostic.DiagnosticType type, SourcePosition pos, java.lang.String msg)
      Deprecated.
       
      void setLocale​(java.util.Locale locale)
      Deprecated.
       
      void warning​(SourcePosition pos, java.lang.String key, java.lang.Object... args)
      Deprecated.
      Print warning message, increment warning count.
      • Methods inherited from class com.sun.tools.javac.util.Log

        currentSourceFile, directError, flush, flush, format, getDefaultMaxErrors, getDefaultMaxWarnings, getDiagnosticFormatter, getLocalizedString, getWriter, getWriterForDiagnosticType, hasDiagnosticListener, instance, localize, localize, localize, popDiagnosticHandler, preRegister, printLines, printLines, printLines, printLines, printLines, printNewline, printNewline, printRawLines, printRawLines, printRawLines, printVerbose, prompt, rawError, rawWarning, report, setDiagnosticFormatter, setEndPosTable, setWriter, setWriters, shouldReport, strictWarning, writeDiagnostic
      • Methods inherited from class com.sun.tools.javac.util.AbstractLog

        currentSource, error, error, error, error, error, error, error, getSource, mandatoryNote, mandatoryWarning, mandatoryWarning, note, note, note, note, useSource, warning, warning, warning, warning, warning
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • programName

        final java.lang.String programName
        Deprecated.
      • locale

        private java.util.Locale locale
        Deprecated.
      • messages

        private final com.sun.tools.javac.util.JavacMessages messages
        Deprecated.
      • javadocDiags

        private final com.sun.tools.javac.util.JCDiagnostic.Factory javadocDiags
        Deprecated.
      • defaultErrWriter

        static final java.io.PrintWriter defaultErrWriter
        Deprecated.
        The default writer for diagnostics
      • defaultWarnWriter

        static final java.io.PrintWriter defaultWarnWriter
        Deprecated.
      • defaultNoticeWriter

        static final java.io.PrintWriter defaultNoticeWriter
        Deprecated.
    • Constructor Detail

      • Messager

        protected Messager​(com.sun.tools.javac.util.Context context,
                           java.lang.String programName)
        Deprecated.
        Constructor
        Parameters:
        programName - Name of the program (for error messages).
      • Messager

        protected Messager​(com.sun.tools.javac.util.Context context,
                           java.lang.String programName,
                           java.io.PrintWriter errWriter,
                           java.io.PrintWriter warnWriter,
                           java.io.PrintWriter noticeWriter)
        Deprecated.
        Constructor
        Parameters:
        programName - Name of the program (for error messages).
        errWriter - Stream for error messages
        warnWriter - Stream for warnings
        noticeWriter - Stream for other messages
    • Method Detail

      • instance0

        public static Messager instance0​(com.sun.tools.javac.util.Context context)
        Deprecated.
        Get the current messager, which is also the compiler log.
      • preRegister

        public static void preRegister​(com.sun.tools.javac.util.Context context,
                                       java.lang.String programName)
        Deprecated.
      • preRegister

        public static void preRegister​(com.sun.tools.javac.util.Context context,
                                       java.lang.String programName,
                                       java.io.PrintWriter errWriter,
                                       java.io.PrintWriter warnWriter,
                                       java.io.PrintWriter noticeWriter)
        Deprecated.
      • setLocale

        public void setLocale​(java.util.Locale locale)
        Deprecated.
      • getText

        java.lang.String getText​(java.lang.String key,
                                 java.lang.Object... args)
        Deprecated.
        get and format message string from resource
        Parameters:
        key - selects message from resource
        args - arguments for the message
      • printError

        public void printError​(java.lang.String msg)
        Deprecated.
        Print error message, increment error count. Part of DocErrorReporter.
        Specified by:
        printError in interface DocErrorReporter
        Parameters:
        msg - message to print
      • printError

        public void printError​(SourcePosition pos,
                               java.lang.String msg)
        Deprecated.
        Print error message, increment error count. Part of DocErrorReporter.
        Specified by:
        printError in interface DocErrorReporter
        Parameters:
        pos - the position where the error occurs
        msg - message to print
      • printWarning

        public void printWarning​(java.lang.String msg)
        Deprecated.
        Print warning message, increment warning count. Part of DocErrorReporter.
        Specified by:
        printWarning in interface DocErrorReporter
        Parameters:
        msg - message to print
      • printWarning

        public void printWarning​(SourcePosition pos,
                                 java.lang.String msg)
        Deprecated.
        Print warning message, increment warning count. Part of DocErrorReporter.
        Specified by:
        printWarning in interface DocErrorReporter
        Parameters:
        pos - the position where the error occurs
        msg - message to print
      • printNotice

        public void printNotice​(java.lang.String msg)
        Deprecated.
        Print a message. Part of DocErrorReporter.
        Specified by:
        printNotice in interface DocErrorReporter
        Parameters:
        msg - message to print
      • printNotice

        public void printNotice​(SourcePosition pos,
                                java.lang.String msg)
        Deprecated.
        Print a message. Part of DocErrorReporter.
        Specified by:
        printNotice in interface DocErrorReporter
        Parameters:
        pos - the position where the error occurs
        msg - message to print
      • error

        public void error​(SourcePosition pos,
                          java.lang.String key,
                          java.lang.Object... args)
        Deprecated.
        Print error message, increment error count.
        Parameters:
        key - selects message from resource
      • warning

        public void warning​(SourcePosition pos,
                            java.lang.String key,
                            java.lang.Object... args)
        Deprecated.
        Print warning message, increment warning count.
        Parameters:
        key - selects message from resource
      • notice

        public void notice​(java.lang.String key,
                           java.lang.Object... args)
        Deprecated.
        Print a message.
        Parameters:
        key - selects message from resource
      • nerrors

        public int nerrors()
        Deprecated.
        Return total number of errors, including those recorded in the compilation log.
      • nwarnings

        public int nwarnings()
        Deprecated.
        Return total number of warnings, including those recorded in the compilation log.
      • exitNotice

        public void exitNotice()
        Deprecated.
        Print exit message.
      • exit

        public void exit()
        Deprecated.
        Force program exit, e.g., from a fatal error.

        TODO: This method does not really belong here.

      • report

        private void report​(com.sun.tools.javac.util.JCDiagnostic.DiagnosticType type,
                            SourcePosition pos,
                            java.lang.String msg)
        Deprecated.