Bug 70969

Summary: [1.5] compile error with conditional operator and wildcards
Product: [Eclipse Project] JDT Reporter: Igor Fedorenko <igor>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Igor Fedorenko CLA 2004-07-28 08:48:41 EDT
Cheetah (from CVS as of few minutes ago) fails to compile the following code
with error message "Type mismatch: cannot convert from RandomAccess to
ArrayList<?>". javac as of b59 accepts the code.

==============================================
package test.cheetah;
import java.util.ArrayList;
public class ConditionalAndWildcard {
    public void test(boolean param) {
        ArrayList<?> ls = (param) ? 
                new ArrayList<String>() : new ArrayList<Object>();
    }
}
==============================================
Comment 1 Philipe Mulet CLA 2004-07-29 10:19:48 EDT
Our lowerUpperBound algorithm did not properly infer that ArrayList<String> 
and ArrayList<Object> had a better common supertype than Object, which is: 
ArrayList<? extends Object>.

Fixed, added regression test GenericTypeTest#test270.
Comment 2 Philipe Mulet CLA 2004-07-29 12:51:54 EDT
Fixed