Community
Participate
Working Groups
Build 3.1.0 The following code yields an infinite regression during type inference: import java.util.*; class X<T extends Comparable<? super T>> { abstract class Foo<E> implements I<Foo<? extends E>> {} abstract class Bar<E> implements I<Bar<? extends E>> {} public void bar(List<Foo<T>> f, List<Bar<T>> b) { foo(f, b); } <C> void foo(List<? extends C> f, List<? extends C> b) { System.out.println("SUCCESS"); } public static void main(String... args) { new X().bar(null, null); } } interface I<U> {}
Problem comes from LUB computation which is recursively performing on an infinite sequence of wildcards: ? extends T, ? extends ? extends T, ... and thus never closes the regression. Changed regression detection to use equivalence instead of strict equality. Added GenericTypeTest#test776. Fixed
Verified in 3.2 M1 with build I20050808-2000.
Verified using M20050923-1430 for 3.1.1