Bug 59641

Summary: [1.5] Compiler should refuse usage of wildcard argument values
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Philipe Mulet CLA 2004-04-22 10:55:17 EDT
Cheetah03

The following program should issue 2 errors:
public class X {
	public static void main(String[] args) {
		XList<?> lx = new XList<X>();
		X x = lx.get();
		lx.add(null);
		lx.add(new X());   // cannot apply add(?)
		lx.slot = new X(); // cannot assign to ?
    }    	
}
class XList<E extends X> {
    E slot;
    void add(E e) {}
    E get() { return null; 
    }
}
Comment 1 Philipe Mulet CLA 2004-04-22 13:04:56 EDT
Added regression test: GenericTypeTest#test145
Comment 2 Philipe Mulet CLA 2004-04-22 13:06:10 EDT
We must disallow usage of methods with wildcard parameter or assigning to field 
which type is a wildcard.

We still tolerate using parameterized wildcard type: foo(X<?>).

Fixed