Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
Javac diagnostics do not cope well with the type-system. Javac diagnostic system falls short when representing complex JDK 5 types such as intersection types, captured types, type-variables and so on. 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.
|