JDK-6492019 : Overhaul compiler diagnostics
  • Type: Enhancement
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 6
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2006-11-09
  • Updated: 2014-02-27
  • Resolved: 2013-05-09
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.
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
There are many compiler diagnostics that could be improved.
This RFE tracks all such issues.  Please either add a new
description note or link to related issues.
From jplan entry 403:

For an invalid cast, javac will write something like:

Cast.java:1: inconvertible types
found   : java.lang.Number
required: java.lang.String
See also: http://blogs.sun.com/ahe?entry=diagnosing_captured_wildcards
Object o = null;
        o -= null;


Test.java:12: operator - cannot be applied to java.lang.Object,<nulltype>
        o -= null;

This should be improved.  This should not refer to the operator -, but
the operator -=.  Furthermore, "java.lang.Object,<nulltype>" is not very
helpful and we should have separate error messages for unary and binary

This is closed as it has been implemented in jdk 7 already.

EVALUATION This is an issue that we are trying to address with a bunch of compiler fixes/enhancements specifically targeting the javac diagnostic system. Here are (listed in a priority order) all the issue that should be tackled in order to address this problem: 1) Addressing the problem of diagnostic arguments prematurely converted into Strings (see CR 6717241) 2) Introducing a new (and possibly flexible) hierarchy of diagnostic formatters (see CR 6720185) 3) Creating a formatter that better integrates with javac type-system (6722234) 4) Addressing diagnostic-specific issues (as the ones described in this CR and also in 4881269, 4881267, 6231440, 5088624, 5101303) See the related CRs for detailed explanations of the specific improvements we are aiming at. I'll keep updating this CR as soon as new pieces of this job will be accomplished.