Bug 70969 - [1.5] compile error with conditional operator and wildcards
Summary: [1.5] compile error with conditional operator and wildcards
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-28 08:48 EDT by Igor Fedorenko CLA
Modified: 2005-01-11 11:01 EST (History)
0 users

See Also:


Attachments

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