Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316257 - Type parameter with generic bound causes a bound mismatch in the generated model code
Summary: Type parameter with generic bound causes a bound mismatch in the generated mo...
Status: CLOSED DUPLICATE of bug 273142
Alias: None
Product: EMF
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-09 04:29 EDT by Joachim Dulinski CLA
Modified: 2010-11-30 16:14 EST (History)
1 user (show)

See Also:


Attachments
Ecore model causing the error (704 bytes, application/octet-stream)
2010-06-09 04:30 EDT, Joachim Dulinski CLA
no flags Details
Genmodel used to generate code (unmodified, i.e. as created by the wizard) (1.23 KB, application/octet-stream)
2010-06-09 04:31 EDT, Joachim Dulinski CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joachim Dulinski CLA 2010-06-09 04:29:28 EDT
Build Identifier: Build id: I20100527-1700 (Helios up-to-date as of today; same behavior with up-to-date Galileo)

Using Ecore and modeling the following classes (without any attributes, non-abstract)

BOClass<T>
BORepository<T extends BOClass<T>>

and generating the model code the generated class BosFactoryImpl.java causes the error

Bound mismatch: The generic method createBORepository() of type BosFactory is not applicable for the arguments (). The inferred type BOClass<BOClass<T>> is not a valid substitute for the bounded parameter <T extends BOClass<T>>

Erasing the type parameter on BOClass, that is in the situation 

BOClass
BORepository<T extends BOClass>

the generated model code has no errors (the model validates without errors or warnings in both cases).


Reproducible: Always

Steps to Reproduce:
1. Create an Ecore project in Eclipse using the attached Ecore model.
2. Create a genmodel for the Ecore model without modifikation
3. Generate the model code.
4. The generated class BosFactoryImpl.java shows the mentioned error
Comment 1 Joachim Dulinski CLA 2010-06-09 04:30:56 EDT
Created attachment 171497 [details]
Ecore model causing the error
Comment 2 Joachim Dulinski CLA 2010-06-09 04:31:59 EDT
Created attachment 171498 [details]
Genmodel used to generate code (unmodified, i.e. as created by the wizard)
Comment 3 Ed Merks CLA 2010-09-07 21:39:17 EDT
The problem isn't reproducible with EMF 2.6.  I'll guess that it's a duplicate of 273142.  

With which version of EMF did you have this problem?

*** This bug has been marked as a duplicate of bug 273142 ***
Comment 4 Stephan Zehrer CLA 2010-11-30 16:14:05 EST
This issue is not a EMF problem it is a general problem of the combination of generics and the factory pattern.

See the discussion with Ed about a similar problem here:

http://www.eclipse.org/forums/index.php?t=msg&th=201011&start=0&S=18d906509b3e9af7d72d772ca0b20a88