Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [XCORE] generated code changes on model size
[XCORE] generated code changes on model size [message #1311518] Wed, 23 April 2014 21:18 Go to next message
Theo Weiß is currently offline Theo WeißFriend
Messages: 9
Registered: January 2014
Junior Member
Hi,

I have a model generated with Xcore version 1.0.2.v20130212-0719 using eclipse 4.2.2. The model holds about 50 class statements. Today I've added some new classes and the generated code changed unexpectedly:
- eStaticClass() of all impl classes changed. Now the function uses ModelPackage.eINSTANCE.getXYZ() instead of ModelPackage.Literals.XYZ.
- ModelPackageImpl needs the new import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl.
- a model.ecore file is generated next to the impl java files.
- and many files changed

Why does this happen?
Should I worry about that?

Regards,
Theo
Re: [XCORE] generated code changes on model size [message #1311941 is a reply to message #1311518] Thu, 24 April 2014 03:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Theo,

Comments below.

On 23/04/2014 11:18 PM, Theo Weiß wrote:
> Hi,
>
> I have a model generated with Xcore version 1.0.2.v20130212-0719 using
> eclipse 4.2.2. The model holds about 50 class statements. Today I've
> added some new classes and the generated code changed unexpectedly:
> - eStaticClass() of all impl classes changed. Now the function uses
> ModelPackage.eINSTANCE.getXYZ() instead of ModelPackage.Literals.XYZ.
This depends on the GenPackage property "Literals Interface".
> - ModelPackageImpl needs the new import
> org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl. - a
> model.ecore file is generated next to the impl java files.
This depends on the GenPackage property "Initialize by Loading"
> - and many files changed
>
> Why does this happen?
Those properties are initialized by analyzing the size of the model to
determine approximately when the generated Literals interface and the
generated logic for initializing the package in the XyzPackageImpl are
likely to exceed Java's 64K byte code limit.
> Should I worry about that?
You can add @GenModel(literalsInterface="true",
initializeByLoading="false") to your "package" header declaration in the
*.xcore resource; you can do via the properties view with the "package"
header selected. It is generally nicer to have the Literals interface
available when it doesn't actually exceed Java's byte code limit.
>
> Regards,
> Theo
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [XCORE] generated code changes on model size [message #1312969 is a reply to message #1311941] Thu, 24 April 2014 16:14 Go to previous messageGo to next message
Theo Weiß is currently offline Theo WeißFriend
Messages: 9
Registered: January 2014
Junior Member
Hi Ed,

thanks a lot for your explanation. Adding the @genModel annotation @GenModel(literalsInterface="true", loadInitialization="false") worked as you've described it. The properties view "Initialize by Loading" property added the "loadInitialization" property to the annotation, looks like it should be OK.
There is one thing that I still don't understand: having the annotation added, does the code generator however take care of the 64K limit or what will happen if this limit is reached?

Regards,
Theo


Re: [XCORE] generated code changes on model size [message #1313029 is a reply to message #1312969] Thu, 24 April 2014 16:59 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33137
Registered: July 2009
Senior Member
Theo,

You'll get a compile error when the byte code limit is exceeded, that
that point you'll be forced to take action, i.e., change the flags to
turn off the generation of the things that are too big. Hopefully you
want reach that point...


On 24/04/2014 6:14 PM, Theo Weiß wrote:
> Hi Ed,
>
> thanks a lot for your explanation. Adding the @genModel annotation
> @GenModel(literalsInterface="true", loadInitialization="false") worked
> as you've described it. The properties view "Initialize by Loading"
> property added the "loadInitialization" property to the annotation,
> looks like it should be OK.
> There is one thing that I still don't understand: having the
> annotation added, does the code generator however take care of the 64K
> limit or what will happen if this limit is reached?
>
> Regards,
> Theo
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [XCORE] generated code changes on model size [message #1313167 is a reply to message #1313029] Thu, 24 April 2014 18:46 Go to previous message
Theo Weiß is currently offline Theo WeißFriend
Messages: 9
Registered: January 2014
Junior Member
Hi Ed,

thanks again for clarifying.

Regards,
Theo
Previous Topic:SVG images in editor which is generated using GMF
Next Topic:OCL query failing since migration to Luna M6
Goto Forum:
  


Current Time: Fri Apr 19 07:27:10 GMT 2024

Powered by FUDForum. Page generated in 0.02517 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top