Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6724071

refactor Log into a front end and back end

XMLWordPrintable

    • b32
    • generic
    • generic
    • Not verified

      Currently, Log is still a big class handling 3 roles.

      1) It is the class used by the majority of the compiler to report errors. As such it is the "front end" to the diagnostic system.
      2) It handles the presentation of diagnostics, in conjuction with the diagnostic formatter system.
      3) It handles (deferred) access to the source code for presentation as part of a diagnostic.

      It would be good to separate (1) from (2) so that we can separate how the compiler creates diagnostics from when and where they are presented. This is useful in the MT work for the
      compiler, where we wish to buffer the diagnostics from concurrent parser threads.

      Separating (1) from (2) necessitates (3) because creating diagnostic objects currently creates objects with an ugly hidden reference to the enclosing Log, because of the need to access line/column info and potentially the source line.

      The proposal is to factor out all the methods for creating diagnostics into a new abstract class BasicLog. This will use the existing single report method to communicate with the back end of Log. In addition, the JCDiagnostic.DiagnosticSource interface will be changed to a new top level class in the Context, providing better cleaner access to cached source files.
      Note: the proposed changed are entirely within the javac.util package; no changes to the rest of the compiler will be required.

            jjg Jonathan Gibbons
            jjg Jonathan Gibbons
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: