Bug 69141

Summary: [1.5] Wildcards with lower bound do not work
Product: [Eclipse Project] JDT Reporter: Samuel Kerschbaumer <kersam>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Samuel Kerschbaumer CLA 2004-07-01 11:08:46 EDT
Consider the following code fragment:

		ArrayList<? super Integer> al = new ArrayList<Object>();
		al.add(new Integer(1)); // (1)
		Integer i = al.get(0);  // (2)

(1) gives you a compiler error. This is not correct because the list al contains 
elements of an unknown type, but the type must be a superclass of Integer
Therefore its completely legal to add an Integer

(2) compiles, but is not legal. The list can contain any type, so a cast to 
Integer is not save!



Using Eclipse 3.0M9 with Cheetah 0.0.6
Comment 1 Philipe Mulet CLA 2004-07-05 07:13:57 EDT
Lower bound check was indeed not properly implemented. Now tolerates 
invocation of method/constructor when parameter type is a wildcard with lower 
bound (similar evolution for assignment).

Also tuned the compatibility check for lower bounded wildcard to only use 
upper bound (i.e. variable) instead of considering bound.

Added regression tests: GenericTypeTest#test220-222.
Comment 2 Philipe Mulet CLA 2004-07-05 07:14:26 EDT
Fixed
Comment 3 Frederic Fusier CLA 2006-04-14 05:04:57 EDT
Verified for 3.1 using build I20050627-1435.