Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338904 - EcoreGeneratorFragment: Avoid generating of .ecore file to .impl package
Summary: EcoreGeneratorFragment: Avoid generating of .ecore file to .impl package
Status: VERIFIED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.1   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: v2.8
Keywords:
: 454868 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-04 04:03 EST by Karsten Thoms CLA
Modified: 2015-02-19 03:48 EST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Karsten Thoms CLA 2011-03-04 04:03:14 EST
If a genmodel package is considered as big (see GenPackageImpl#initialize(), end of method), the flag "loadInitialization" is set to true. This causes that in GenPackageGeneratorAdapter#generatePackageSerialization() an .ecore resource is created for the Class Impl package.

Since the .ecore file should and is produced already to the main package the production of this obsolete .ecore file should be suppressed.

More than this, this .ecore file can cause troubles in Xpand projects, since references to external Ecore models cause unresolvable proxies and this .ecore file collides with the one produced by Xtext.

I propose to add the following to EcoreGeneratorFragment#getSaveAndReconcileGenModel:

=================================================================
  for (GenPackage genPackage : genModel.getGenPackages()) {
    genPackage.setBasePackage(getBasePackage(grammar));
    // changed here!
    genPackage.setLoadInitialization(false);
=================================================================
Comment 1 Sven Efftinge CLA 2011-03-04 04:28:58 EST
EMF does this to not exceed the allowed size of bytecode elements in the generated java class (a java class and its features cannot be arbitrary big). Therefore we cannot set it generally to false like you proposed.
Sorry.
Comment 2 Karsten Thoms CLA 2011-03-04 09:23:38 EST
Could you add an option (disabled by default) to configure the EcoreGeneratorFragment, if it is really desired to handle it this way?
Comment 3 Sven Efftinge CLA 2011-03-07 04:15:54 EST
Yes, that's ok.
Comment 4 Sven Efftinge CLA 2014-12-11 08:49:36 EST
We should also investigate whether we could change the file extension of the generated file, or if the ecore ResourceDescription Manager can somehow quickly detect that this kind of resources must not be indexed.
Comment 5 Miro Spönemann CLA 2014-12-11 10:43:58 EST
I added an option to suppress the load initialization mode:
https://git.eclipse.org/r/#/c/38035/

I also modified the file extension of the generated ecore file:
https://git.eclipse.org/r/#/c/38048/
Unfortunately the file extension is hard-coded in GenPackageImpl.getSerializedPackageFilename(), so I had to override it in a subclass.
Comment 6 Sebastian Zarnekow CLA 2014-12-12 04:09:45 EST
Thanks Miro.
Comment 7 Sven Efftinge CLA 2015-02-02 03:23:26 EST
*** Bug 454868 has been marked as a duplicate of this bug. ***