Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Too many constants, the constant pool for AlgoIQPackage would exceed 65536 entries(when i am creating variable and enums in ecore,after generating it is throwing too many constants error in my algoIQ Package.)
Too many constants, the constant pool for AlgoIQPackage would exceed 65536 entries [message #1815313] Mon, 30 September 2019 12:35 Go to next message
rajni choudhary is currently offline rajni choudharyFriend
Messages: 6
Registered: September 2019
Junior Member
while creating new variable and ecore i am getting too many constants,the constant pool error and i got suggestion saying If your package is really big, it's probably automated set the GenPackage's "Model-> Initialize by Loading" to true.
but my model--> Initialize by Loading to true is already set to true but still it is throwing me error.please suggest some more solutions.
Re: Too many constants, the constant pool for AlgoIQPackage would exceed 65536 entries [message #1815314 is a reply to message #1815313] Mon, 30 September 2019 12:57 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30687
Registered: July 2009
Senior Member
And you've also set "Model-> Literals Interface" to false as suggested in the answer here?

https://www.eclipse.org/forums/index.php/mv/msg/1100744/1815312/#msg_1815312
Re: Too many constants, the constant pool for AlgoIQPackage would exceed 65536 entries [message #1815352 is a reply to message #1815314] Tue, 01 October 2019 09:45 Go to previous messageGo to next message
rajni choudhary is currently offline rajni choudharyFriend
Messages: 6
Registered: September 2019
Junior Member
Hi Ed,

Thanks for help.
Yes, "Model-> Literals Interface" is set to false, still I am getting this issue.


  • Attachment: Issue.png
    (Size: 50.35KB, Downloaded 5 times)

[Updated on: Tue, 01 October 2019 09:48]

Report message to a moderator

Re: Too many constants, the constant pool for AlgoIQPackage would exceed 65536 entries [message #1815357 is a reply to message #1815352] Tue, 01 October 2019 11:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30687
Registered: July 2009
Senior Member
Then your model is probably just too big to represent it reasonably in Java; I've never seen a model so big that it had such a problem. Typically the problem is more likely to get too much byte code for a class's initializers or for a method's body. But it's of course possible to have too many features in a single class such that methods like the XyzImpl.eGet will have too much byte code. I.e., it's always possible to exceed limits. A model with literally 65,000 classes + features does not seem within the capacity of a human being to understand. Presumably this Ecore model was mapped from something else as the source because no human being could or would design such a monstrosity. Perhaps this comes from some obscenely big XML Schema? In that case, you should stop to consider if it's really actually sensible to generate Java code for the model for this use case. Who would actually need to write code against such monstrous generated API? You could just use the *.ecore as a dynamic model instead...

I assume this error appears directly on the AlgoIQPackage interface and not in some nested interface; correct me if that's wrong.

Re: Too many constants, the constant pool for AlgoIQPackage would exceed 65536 entries [message #1815361 is a reply to message #1815357] Tue, 01 October 2019 11:37 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6536
Registered: July 2009
Senior Member
Hi

Once you exhaust other alternatives, you might want to investigate the variant JET templates in

https://git.eclipse.org/c/ocl/org.eclipse.ocl.git/tree/examples/org.eclipse.ocl.examples.codegen/templates/model

These eliminate almost all of the INT constants replacing them by inline references. Only those needed by extending models are retained and these are placed in individual ClassImpl files rather than all in one PackageImpl.

(See the numeric switch cases in https://git.eclipse.org/c/ocl/org.eclipse.ocl.git/tree/plugins/org.eclipse.ocl.pivot/emf-gen/org/eclipse/ocl/pivot/internal/ClassImpl.java )

NB. The use of alternate templates only works when you use a programmatic invocation of GenModel such as an MWE2 script.

Regards

Ed Willink
Previous Topic:I create an xml element by right click to EMF editor. Default values appear but not get saved to xml
Next Topic:Ecore Generate Problem by creating EMF Project
Goto Forum:
  


Current Time: Mon Dec 09 21:40:29 GMT 2019

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

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

Back to the top