-
Enhancement
-
Resolution: Fixed
-
P3
-
6, 7
-
b62
-
generic
-
generic
-
Verified
Examples:
1) ********************
CODE:
class Foo<T extends String> {
<T extends Integer> void foo(T t) {
test(t);
}
void test(T t) {}
}
RESULTS:
Test.java:6: test(T) in Foo<T> cannot be applied to (T)
test(t);
^
1 error
PROBLEM:
The diagnostic is ambiguous (as also reported in 5101303). Please add some info about the site in which the type-variable has been declared.
2) **********************************************
CODE:
import javax.tools.*;
class Test {
static void test() {
JavaCompiler compiler = null;
compiler.getTask(null, null, null,
"Bad Argument", null, null);
} }
RESULTS:
Test.java:6: getTask(java.io.Writer,javax.tools.JavaFileManager,
javax.tools.DiagnosticListener<? super javax.tools.JavaFileObject>,
java.lang.Iterable<java.lang.String>,java.lang.Iterable<java.lang.String>,
java.lang.Iterable<? extends javax.tools.JavaFileObject>) in javax.tools.
JavaCompiler cannot be applied to (<nulltype>,<nulltype>,<nulltype>,
java.lang.String,<nulltype>,<nulltype>)
compiler.getTask(null,null,null,"Bad Argument",null,null);
^
1 error
PROBLEMS
Too verbose. Can be improved by dropping qualified names in favor of simple names.
3) **********************************************************************
CODE:
interface List<E> {}
class Test {
<T> void merge(List<T> l1, List<T> l2) {}
void test(List<? extends Test> list) {
merge(list, list);
}
}
RESULTS:
Test.java:6: <T>merge(List<T>,List<T>) in Test cannot be applied to (List<capture#173 of ? extends Test>,List<capture#228 of ? extends Test>)
merge(list, list);
^
1 error
PROBLEMS
The diagnostic is too unfriendly for a non-generics guru.
- relates to
-
JDK-6845686 basic and raw formatters do not display captured var id properly when javac runs in -XDoldDiags mode
-
- Closed
-
-
JDK-6864382 NPE in the rich formatter when processing an unattributed type-variable
-
- Closed
-
-
JDK-6735840 Need a type/symbol visitor printer
-
- Closed
-
-
JDK-6860795 NullPointerException when compiling a negative java source
-
- Closed
-
-
JDK-6862608 rich diagnostic sometimes contain wrong type variable numbering
-
- Closed
-
-
JDK-6828205 Javac incorrectly describes the type of ternary expressions in error messages
-
- Closed
-
-
JDK-6231440 Better diagnostic desired for common mistake with array creation
-
- Open
-
-
JDK-6492019 Overhaul compiler diagnostics
-
- Resolved
-
-
JDK-6768932 Add support for multiline diagnostics
-
- Closed
-
-
JDK-6769027 Source line should be displayed immediately after the first diagnostic line
-
- Closed
-
-
JDK-6852649 The Rich formatter printer should be an explicit class to facilitate overriding
-
- Closed
-
-
JDK-7098660 Write better overload resolution/inference tests
-
- Closed
-