-
Enhancement
-
Resolution: Fixed
-
P3
-
7
-
b50
-
generic, unknown
-
generic
-
Verified
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).
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).
- duplicates
-
JDK-6754437 new option -XDdiags
-
- Closed
-
- relates to
-
JDK-6722234 javac diagnostics need better integration with the type-system
-
- Closed
-
-
JDK-5088624 cannot find symbol message should be more intelligent
-
- Closed
-
-
JDK-6768932 Add support for multiline diagnostics
-
- Closed
-