Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Error The code for the static initializer is exceeding the 65535 bytes limit on the UI grammar(UI grammar too big)
Error The code for the static initializer is exceeding the 65535 bytes limit on the UI grammar [message #1065729] Thu, 27 June 2013 09:44 Go to next message
Christian Mauceri is currently offline Christian MauceriFriend
Messages: 22
Registered: May 2012
Location: Paris
Junior Member
I got the famous error : "The code for the static initializer is exceeding the 65535 bytes limit" on the ui antlr grammar, while the first internal parser of my XText grammar has no error at all. Did anybody face this issue ?

[Updated on: Thu, 27 June 2013 09:56]

Report message to a moderator

Re: Error The code for the static initializer is exceeding the 65535 bytes limit on the UI grammar [message #1065763 is a reply to message #1065729] Thu, 27 June 2013 12:26 Go to previous messageGo to next message
Jens Kuenzer is currently offline Jens KuenzerFriend
Messages: 29
Registered: October 2009
Junior Member
Maybe in the workflow, setting the GenaratorFragment options = { classSplitting = true } might help.
Re: Error The code for the static initializer is exceeding the 65535 bytes limit on the UI grammar [message #1065776 is a reply to message #1065763] Thu, 27 June 2013 12:52 Go to previous messageGo to next message
Christian Mauceri is currently offline Christian MauceriFriend
Messages: 22
Registered: May 2012
Location: Paris
Junior Member
Not really, as far as I can see it impacts the xtext parser not the ui one, and worse, it generates new errors in the text parser which worked perfectly before.
To be clear I call text parse the antler parse generated in the same project as the text grammar and ui parser the one generated in the ui project.
Re: Error The code for the static initializer is exceeding the 65535 bytes limit on the UI grammar [message #1065777 is a reply to message #1065776] Thu, 27 June 2013 12:57 Go to previous messageGo to next message
Christian Mauceri is currently offline Christian MauceriFriend
Messages: 22
Registered: May 2012
Location: Paris
Junior Member
In order to have the grammar split working, one must write other pieces of code and manipulate the generated classes : a nightmare if you have to modify your grammar.
Re: Error The code for the static initializer is exceeding the 65535 bytes limit on the UI grammar [message #1065873 is a reply to message #1065777] Fri, 28 June 2013 06:32 Go to previous messageGo to next message
Christian Mauceri is currently offline Christian MauceriFriend
Messages: 22
Registered: May 2012
Location: Paris
Junior Member
There are 189 rules and 32 syntactic predicates in my grammar, I set the following options:
classSplitting=true
fieldsPerClass = "100"
methodsPerClass= "100"
There is no warning in the editor nor during the artifacts generation, the main project is clean and the java parser does not even have a warning but the internal parser in the mydsl.ui project shows the error: "the code for the static initializer is exceeding the 65535 bytes limit on the UI grammar".
Can somebody from Temis give an advice ?
Re: Error The code for the static initializer is exceeding the 65535 bytes limit on the UI grammar [message #1065874 is a reply to message #1065873] Fri, 28 June 2013 06:33 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Did you set the options for the ui parser as well?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Error The code for the static initializer is exceeding the 65535 bytes limit on the UI grammar [message #1065877 is a reply to message #1065874] Fri, 28 June 2013 06:51 Go to previous messageGo to next message
Christian Mauceri is currently offline Christian MauceriFriend
Messages: 22
Registered: May 2012
Location: Paris
Junior Member
Can you tell me how I can set these options for the ui parser ? I do not see where it is indicated in the documentation.
Re: Error The code for the static initializer is exceeding the 65535 bytes limit on the UI grammar [message #1065879 is a reply to message #1065877] Fri, 28 June 2013 06:57 Go to previous messageGo to next message
Christian Mauceri is currently offline Christian MauceriFriend
Messages: 22
Registered: May 2012
Location: Paris
Junior Member
I found it, it works, with the same settings, thanks.
Re: Error The code for the static initializer is exceeding the 65535 bytes limit on the UI grammar [message #1065921 is a reply to message #1065879] Fri, 28 June 2013 10:38 Go to previous message
Christian Mauceri is currently offline Christian MauceriFriend
Messages: 22
Registered: May 2012
Location: Paris
Junior Member
So for those reading this thread I summarize. ANTLR grammar generate their parser as DFA written in Java, the problem is java machine has an inherent limitation such that methods cannot exceed 64K. As your grammar grows you can get DFA exceeding this limitation, XText provides an option to split methods and fields in order ANTLR produces smaller DFA methods, but there are two ANTLR parsers produced by XText, one directly corresponding to the DSL grammar and one corresponding to the UI and the settings must be given separately for both of them. In the DSL generator mwe2, the two fragments are :


  • parser.antlr.XtextAntlrGeneratorFragment
  • parser.antlr.XtextAntlrUiGeneratorFragment


For instance, in my case, I wrote :

fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject {
options = {
// backtrack = true
classSplitting=true
fieldsPerClass = "100"
methodsPerClass= "100"
}
}

fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {
options = {
// backtrack = true
classSplitting=true
fieldsPerClass = "100"
methodsPerClass= "100"
}

in the file:
/com.ibm.jrules.xtext.iros/src/com/ibm/jrules/xtext/iros/GenerateIROS.mwe2
standing next to my grammar file:
/com.ibm.jrules.xtext.iros/src/com/ibm/jrules/xtext/iros/IROS.xtext

One must be careful with the variables fieldsPerClass and methodsPerClass, too small values generates error, you can also (what happens to me) have grammar producing sufficiently small DFAs but generating too big UI grammar and only the second settings need to be given.

[Updated on: Fri, 28 June 2013 10:44]

Report message to a moderator

Previous Topic:Collapsing all comments
Next Topic:SWT TableViewer Issue
Goto Forum:
  


Current Time: Thu Apr 25 05:26:00 GMT 2024

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

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

Back to the top