Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316257

Summary: Type parameter with generic bound causes a bound mismatch in the generated model code
Product: [Modeling] EMF Reporter: Joachim Dulinski <joachim.dulinski>
Component: CoreAssignee: Ed Merks <Ed.Merks>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: eclipse
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Ecore model causing the error
none
Genmodel used to generate code (unmodified, i.e. as created by the wizard) none

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