Bug 83225 - [1.5] incorrect(?) compiler errors with type inference
Summary: [1.5] incorrect(?) compiler errors with type inference
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-19 13:46 EST by Adam Kiezun CLA
Modified: 2005-02-15 06:24 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 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