Bug 112500 - [1.5][compiler] bug between inference and wilcard
Summary: [1.5][compiler] bug between inference and wilcard
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1.2   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 121231 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-10-13 11:10 EDT by Rémi Forax CLA
Modified: 2006-01-10 10:33 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rémi Forax CLA 2005-10-13 11:10:20 EDT
The following code doesn't work with eclipse but
works with javac.

static <T> List<T> merge(List<? extends T> a,List<? extends T> b) {
  return null;
}
public static void main(String[] args) {
 List<String> list1=null;
 List<StringBuilder> list2=null;
 List<? extends CharSequence> result = merge(list1,list2);
}

Rémi Forax
Comment 1 Philipe Mulet CLA 2005-10-13 12:16:21 EDT
Indeed, we should accept it. Current error is:

	List<? extends CharSequence> result = merge(list1, list2);
	                                      ^^^^^^^^^^^^^^^^^^^
Type mismatch: cannot convert from List<Object&Serializable&CharSequence> to
List<? extends CharSequence>

which is clearly wrong. Seems to be an issue with intersection type.
Comment 2 Philipe Mulet CLA 2005-10-13 12:36:21 EDT
TypeBinding#isTypeArgumentContainedBy(...) did not properly handle intersection
type. 

Fixed. Added GenericTypeTest#test842.
Released in 3.1 maintenance and 3.2 branch.
Comment 3 Olivier Thomann CLA 2005-12-19 13:17:12 EST
*** Bug 121231 has been marked as a duplicate of this bug. ***
Comment 4 Olivier Thomann CLA 2006-01-09 11:04:23 EST
Verified for 3.1.2 in M20060109-0800.
Comment 5 Olivier Thomann CLA 2006-01-10 10:33:59 EST
Verified for 3.2M4 in I20051215-1506