Change in javac generics type inference
Martin Buchholz
martinrb at google.com
Thu Feb 5 18:38:46 PST 2009
Hi javac maintainers,
We have a program that started to fail to compile as of jdk7-b05
(openjdk6 is naturally also affected)
I'm not an expert on generics type inference,
but the code seems reasonable, and used to compile,
so....bug?
$ cat Bug.java; for java in jdk1.7.0-b04 jdk1.7.0-b05; do echo ---
$java ---- ; /home/build/static/projects_norep/java/sun-jdk/linux-i586/$java/bin/javac
Bug.java; done
public class Bug {
public static <K extends Key<K>, E extends Entity<E, K>> void get(E entity) {}
public interface Entity<E extends Entity<E, K>, K extends Key<K>> {}
public interface Key<K extends Key<K>> {}
public static class EntityImpl implements Entity<EntityImpl, KeyImpl> {}
public static class KeyImpl implements Key<KeyImpl> {}
public static void main(String[] args) {
EntityImpl e = new EntityImpl();
get(e);
}
}
--- jdk1.7.0-b04 ----
--- jdk1.7.0-b05 ----
Bug.java:15: incompatible types; inferred type argument(s)
java.lang.Object do not conform to bounds of type variable(s) K
found : <K>void
required: void
get(e);
^
1 error
More information about the compiler-dev
mailing list