Generics compiles and runs in Eclipse, but doesn’t compile in javac

This is a confirmed bug: Bug ID 6468354. Here’s an extract of relevance:

This problem is caused by the fact that sometimes javac’s implementation of JLS3 15.12.2.8 ignores recursive bounds, sometimes not (as in this case). When recursive bounds contains wildcards, such bounds are included when computing uninferred type variables. This makes subsequent subtyping test (Integer <: Comparable<? super T> where T is a type-variable to be inferred).

Will be fixed after 6369605

Occured to me on WinXP with 1.6.0_13 as well. Ah well, I’ll just stick using Eclipse 🙂

Leave a Comment