JDK-6492019 : Overhaul compiler diagnostics
  • Type: Enhancement
  • Status: Resolved
  • Resolution: Fixed
  • Component: tools
  • Sub-Component: javac
  • Priority: P3
  • Affected Version: 6
  • OS: generic
  • CPU: generic
  • Submit Date: 2006-11-09
  • Updated Date: 2014-02-27
  • Resolved Date: 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 Availabitlity Release.

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

Gives:

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
operators.

Comments
This is closed as it has been implemented in jdk 7 already.
2013-05-09

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.
2008-06-20