Bug 215122 - [1.5][compiler] unhelpful errors on generics with wildcards and multiple bounds
Summary: [1.5][compiler] unhelpful errors on generics with wildcards and multiple bounds
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-12 12:49 EST by David Waite CLA
Modified: 2008-01-15 13:04 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 David Waite CLA 2008-01-12 12:49:19 EST
Build ID: I20080108-1320

Steps To Reproduce:
Under situations where a generic type is specified in terms of its generic parameter extending multiple interfaces, the compiler will emit errors which do not help the user understand what they are doing wrong. It would be useful to explain to the user that multiple bounds cannot be used within a generic type definition.

Sample code of success and failures provided below

More information:
public interface Testable {
	<T extends Comparable<?> & Iterable<?>> void w1(T foo); // Works
	<T extends Comparable<?> & Iterable<?>> void w2(Class<T> foo); // Works
	<T extends Comparable<?> & Iterable<?>> Class<T> w3(); // Works

	Class<? extends Comparable<?> & Iterable<?> > f1(); // Fails
	void f2(Class<? extends Comparable<?> & Iterable<?>> foo); // Fails	
}
Comment 1 Philipe Mulet CLA 2008-01-15 13:03:45 EST
This would mean making the grammar more permissive and report the issue later on....
Comment 2 Philipe Mulet CLA 2008-01-15 13:04:50 EST
Note that javac doesn't do any better than we do.