Bug 103023 - [1.5][compiler] StackOverflow inferring type arguments
Summary: [1.5][compiler] StackOverflow inferring type arguments
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-07 11:02 EDT by Philipe Mulet CLA
Modified: 2005-09-26 10:41 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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