Java 6 is not good at inferring the type constraints