Community
Participate
Working Groups
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); =================================================================
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.
Could you add an option (disabled by default) to configure the EcoreGeneratorFragment, if it is really desired to handle it this way?
Yes, that's ok.
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.
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.
Thanks Miro.
*** Bug 454868 has been marked as a duplicate of this bug. ***