JDK-6724071 : refactor Log into a front end and back end
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-07-09
  • Updated: 2011-05-18
  • Resolved: 2011-05-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b32Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Description
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.

Comments
EVALUATION Long overdue cleanup of the code to handle source files in Log.
09-07-2008