Community
Participate
Working Groups
N20050721-0010 public class Try { void shouldcompile() { java.util.Collections.max(null); } } The eclipse compiler rejects with error: "Bound mismatch: The generic method max(Collection<? extends T>) of type Collections is not applicable for the arguments (Collection<? extends Comparable<? super T>>) since the type Comparable<? super T> is not a valid substitute for the bounded parameter <T extends Object & Comparable<? super T>>" javac bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6299211
Tuned bound check after inference. Problem came from the fact T got inferred to Comparable<? super T> by default (since didn't get inferred from 'null' argument but rather using formal bound); which got substituted before performing bound check (and thus got compared to: Comparable<? super Comparable<? super T>> Fixed. Added GenericTypeTest#test792
Verified for 3.2M1 (I20050808-2000)
Verified using M20050923-1430 for 3.1.1