Bug 59641 - [1.5] Compiler should refuse usage of wildcard argument values
Summary: [1.5] Compiler should refuse usage of wildcard argument values
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-22 10:55 EDT by Philipe Mulet CLA
Modified: 2005-01-11 11:02 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 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