Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6769027
Votes 0
Synopsis Source line should be displayed immediately after the first diagnostic line
Category java:compiler
Reported Against
Release Fixed 7(b50)
State 10-Fix Delivered, request for enhancement
Priority: 3-Medium
Related Bugs 6722234 , 6768932 , 5088624
Submit Date 07-NOV-2008
Description
Recent work on javac diagnostics have underlined the need for better diagnostics; the diagnostics to be improved, esp. those regarding the type-system area of the compiler, have a problem in that they could in principle add too many lines before the erroneous source line is diaplayed; consider the following cases:

Examples:

1) Type-system diagnostic:

Test.java:3: method test in class Foo<T #0> cannot be applied to given types
   required: T #0
   found: T #1
      where T #0,T #1 are typevariables:
          T #0 extends String
              (declared in class Foo)
          T #1 extends Integer
              (declared in method <T>foo(T))
	<ERROR LINE HERE>
1 error

2) Method resolution diagnostics

Test.java:6: no suitable method m found for (String,String)
    method: <T>m(T,T) in Test
      (inferred type argument(s) String do not conform to bounds of type variable(s) T)
    method: m(Integer) in Test       
	<ERROR LINE HERE>
1 error

Despite being an effective way for separating different diagnostics, having source line printed only at the end of the diagnostic output makes the whole diagnostic (i) less readable - because people have to parser the diagnostic contents in order to find the actual erroneous line and (ii) less scalable - because we would like to be able to give the users the flexibility to turn on/off diagnostic features (e.g. where clauses/detailed diagnostics).
Posted Date : 2008-11-07 17:31:30.0
Work Around
N/A
Evaluation
Will do. Many have suggested that the following template should be adopted:

<FIRST LINE>
<ERROR LINE>
<CARET>
<DIAGNOSTIC DETAILS>
<SEPARATOR>

Note that a separator (e.g. newline) is required in order to provide better visual feedback to the user (since the caret is not the last thing of a diagnostic anymore!).
Posted Date : 2008-11-07 17:31:30.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang