Bug 83225

Summary: [1.5] incorrect(?) compiler errors with type inference
Product: [Eclipse Project] JDT Reporter: Adam Kiezun <akiezun>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Adam Kiezun CLA 2005-01-19 13:46:39 EST
3.1M4
there're differences between javac and eclipse's compiler wrt type inference:
class Test {
public static <T> T choose(boolean b, T t1, T t2){
	if (b) return t1; else return t2;
}
	
public static void foo(){
	Comparable s1= choose(true, "string", new Integer(1));
	Number     s2= choose(true, new Integer(1), new Float(2));
	Comparable s3= choose(true, new Integer(1), new Float(2));
}
}

eclipse complains about s1 and s3 - javac likes them
Comment 1 Philipe Mulet CLA 2005-01-27 05:49:09 EST
Added support to construct more sophisticated types representing all minimal
supertypes, as opposed to first one.

Added GenericTypeTest#test470.
Fixed
Comment 2 Jerome Lanneluc CLA 2005-02-15 06:24:35 EST
Verified in I20050214