Bug 107193 - [1.5][compiler] Wrong error in conditional expression with unequal array types (1.5 only)
Summary: [1.5][compiler] Wrong error in conditional expression with unequal array type...
Status: RESOLVED DUPLICATE of bug 106936
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-17 06:23 EDT by Markus Keller CLA
Modified: 2005-08-18 09:27 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 Markus Keller CLA 2005-08-17 06:23:44 EDT
I20050816-1235

class RecipeElement {
    public static final RecipeElement[] NO_CHILDREN= new RecipeElement[0]; 
}

class Ingredient extends RecipeElement { }

class IngredientsSection extends RecipeElement {
    private Ingredient[] fIngredients;
    
    public RecipeElement[] getChildren() {
        return fIngredients == null ? NO_CHILDREN : fIngredients;
    }
}

The latest I-build reports an error at the conditional expression iff compiled
with 5.0 (still fine with 1.4): "Type mismatch: cannot convert from
Object&Serializable&Cloneable to RecipeElement[]"

This worked fine in 3.2M1. Javac also compiles without errors.
Comment 1 Olivier Thomann CLA 2005-08-17 09:30:12 EDT
Fixed in HEAD.
Closing as duplicate of bug 106936.
Please reopen if you get it using HEAD contents.

*** This bug has been marked as a duplicate of 106936 ***
Comment 2 Olivier Thomann CLA 2005-08-18 09:27:10 EDT
Added regression test
org.eclipse.jdt.core.tests.compiler.regression.ConditionalExpressionTest.test002