Bug 103023

Summary: [1.5][compiler] StackOverflow inferring type arguments
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Philipe Mulet CLA 2005-07-07 11:02:15 EDT
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> {}
Comment 1 Philipe Mulet CLA 2005-07-07 11:04:59 EDT
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
Comment 2 Maxime Daniel CLA 2005-08-09 10:48:19 EDT
Verified in 3.2 M1 with build I20050808-2000.
Comment 3 David Audel CLA 2005-09-26 10:41:10 EDT
Verified using M20050923-1430 for 3.1.1