United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6403465 : javac should defer diagnostics until it can be determined they are persistent

Details
Type:
Bug
Submit Date:
2006-03-24
Status:
Closed
Updated Date:
2011-04-21
Project Name:
JDK
Resolved Date:
2011-03-07
Component:
tools
OS:
generic,linux
Sub-Component:
javac
CPU:
generic,x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Duplicate:
Duplicate:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:
Relates:

Sub Tasks

Description
Currently, javac will report diagnostics, either in the default manner or via a DiagnosticListener, even if those errors are effectively transient errors that will go away on subsequent processing rounds.

javac should buffer and defer such diagnostics until it can be determined whether they should be suppressed or not.
.
.
From experience with apt, various others requests have come in for improved error handling of various sorts:

5052910 need option to turn javac errors into apt errors
Fail-fast if any error compilation error is found.

6432333 APT fails to gracefully handle errors
Request to fail-fast or return a more useful annotation type for a malformed annotation.

                                    

Comments
EVALUATION

Unfortunately, AbstractLog does not help since you cannot install an alternative Log impl in time. Therefore the buffering has to be done inside the existing Log impl.

Then, the next step is a change in strategy. Rather than identifying unrecoverable errors, identify the recoverable errors instead -- i.e. the errors that can arise from missing symbols, which might be fixed after a round of annotation processing.  These errors are all generated via Resolve.logResolveError, so that gives a convenient place to tag all recoverable errors.

The final step is to change JavacProcessingEnvironment.Round.unrecoverableError to check whether any conditions have arisen which should stop annotation processing -- these include errors reported by the messager, any warnings if -Werror is set, and any javac errors that did not come from Resolve.logResolveError.
                                     
2010-08-23
EVALUATION

This is made easier by the recent refactoring of Log into AbstractLog and Log 6724071
                                     
2008-07-24
EVALUATION

Quality of implementation issue for annotation processing.
                                     
2006-03-31



Hardware and Software, Engineered to Work Together