Bug 79628 - [1.5][compiler] Semantics for Generics not the same as for Sun
Summary: [1.5][compiler] Semantics for Generics not the same as for Sun
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-27 15:04 EST by Eric Goff CLA
Modified: 2005-01-15 09:06 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 Eric Goff CLA 2004-11-27 15:04:39 EST
I have the following declarations:

public interface PropertiedObject<B extends PropertiedObject<B>>

public interface Model extends PropertiedObject<Model>

public interface View<T extends Model,U> extends PropertiedObject<View<?,?>>

Sun's compiler is perfectly happy with it the declaration of View, while
eclipse's is not.

From a logical standpoint the declaration makes perfect sense,
so I think this is a bug with eclipse.
Comment 1 Eric Goff CLA 2004-11-27 15:07:26 EST
sorry, here are the errors

Severity	Description	Resource	In Folder	Location	Creation Time
2	Bound mismatch: The type View<?,?> is not a valid substitute for the bounded
parameter <B extends PropertiedObject<B>> of the type PropertiedObject<B>
View.java	base/src/org/liberatis/sphaera/mvc	line 45	November 27, 2004 1:21:22 PM

Severity	Description	Resource	In Folder	Location	Creation Time
2	The type View cannot extend or implement PropertiedObject<View<?,?>>. A
supertype may not specify any wildcard	View.java
base/src/org/liberatis/sphaera/mvc	line 45	November 27, 2004 1:21:22 PM
Comment 2 Eric Goff CLA 2004-11-29 10:30:38 EST
Just thought I would add what I am trying to accomplish.
It mightb e helpful.

I have an abstract hierarchical object called PropertiedObject.
It allows a generic type for every member in the tree.
Every member of the tree extends the generic type (which also extends
PropertiedObject)

i.e.
A tree of "Model"'s
A tree of "View<?,?>"'s

Both Model and View extend PropertiedObject.

When I defined "View":

View<T,U> extends PropertiedObject<View<?,?>>,
the types for things like children, grandparents, parents, etc.
are logically not known.   So eclipse's error that View<?,?> 
must be qualifed is incorrect IMHO.

cheers,
Eric
Comment 3 Philipe Mulet CLA 2005-01-15 09:06:05 EST
This was fixed a while ago. Only direct wildcards are complained against.
Added GenericTypeTest#test462.