Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 361746 - static initializer is exceeding the 65535 bytes limit in InternalXXXParser.java with xtext 2.0.1
Summary: static initializer is exceeding the 65535 bytes limit in InternalXXXParser.ja...
Status: CLOSED WORKSFORME
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: SR2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-23 05:37 EDT by Mahmoud Moneeb CLA
Modified: 2011-10-25 09:07 EDT (History)
2 users (show)

See Also:
sebastian.zarnekow: indigo+


Attachments
Grammar that generated this problem (48.39 KB, text/plain)
2011-10-23 05:39 EDT, Mahmoud Moneeb CLA
no flags Details
Uploaded projects with successfully generated parsers (1.64 MB, application/zip)
2011-10-25 07:07 EDT, Sebastian Zarnekow CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mahmoud Moneeb CLA 2011-10-23 05:37:33 EDT
Build Identifier: M20110909-1335

I have implemented a DSL grammar rules ,that is relatively big, and everything went fine during building the project except that the generated parser in the UI project ("InternalMyDslParser.java") suffers from the huge number of static initialization of the rules and give me this error 

"The code for the static initializer is exceeding the 65535 bytes limit"



I tried the Head revision 2.1  and  options = {
                  classSplitting=true
                  fieldsPerClass = "500" 
                }
once in the " fragment = parser.antlr.XtextAntlrGeneratorFragment "
and again in the "fragment = parser.antlr.XtextAntlrUiGeneratorFragment"'

But it still gives me the same error and the same generated parser code

Best regards,
Mahmoud

Reproducible: Always
Comment 1 Mahmoud Moneeb CLA 2011-10-23 05:39:13 EDT
Created attachment 205765 [details]
Grammar that generated this problem
Comment 2 Mahmoud Moneeb CLA 2011-10-23 05:56:01 EDT
My configurations


//The antlr parser generator fragment.
  fragment = parser.antlr.XtextAntlrGeneratorFragment {
  options = {
       backtrack = true
       classSplitting = true
       fieldsPerClass = "500" 
    }
  }
            
            
fragment = parser.antlr.XtextAntlrUiGeneratorFragment {
     options = {
      backtrack = true
      classSplitting = true
      fieldsPerClass = "500" 
   }
}
Comment 3 Sven Efftinge CLA 2011-10-23 05:59:54 EDT
Please try the latest nightly build.
Comment 4 Mahmoud Moneeb CLA 2011-10-23 06:11:45 EDT
(In reply to comment #3)
> Please try the latest nightly build.

I did Sven and still facing the same problem.
Comment 5 Sebastian Zarnekow CLA 2011-10-23 11:53:06 EDT
I got a lot of errors when I try to generate the grammar. Which encoding did you use for the uploaded file?

After removing the bogus characters (which only affect the lexer and not the parser), I could generate the code without any problems using the latest nightly.

Please reopen if you can provide more information.
Comment 6 Mahmoud Moneeb CLA 2011-10-25 05:49:15 EDT
(In reply to comment #5)
> I got a lot of errors when I try to generate the grammar. Which encoding did
> you use for the uploaded file?
> 
> After removing the bogus characters (which only affect the lexer and not the
> parser), I could generate the code without any problems using the latest
> nightly.
> 
> Please reopen if you can provide more information.

Hi,

I removed the symbols and still giving me the same error in the 

InternalMyDslParser.java in the package org.text.example.mydsl.ui.contentasssist.antlr.internal

Best regards,
Mahmoud
Comment 7 Sebastian Zarnekow CLA 2011-10-25 05:50:11 EDT
(In reply to comment #5)
> Which encoding did you use for the uploaded file?
Comment 8 Mahmoud Moneeb CLA 2011-10-25 06:28:13 EDT
(In reply to comment #7)
> (In reply to comment #5)
> > Which encoding did you use for the uploaded file?

The file encoding is Cp1252 and I have selected auto-detect. Do you want special encoding for the grammar file ?!
Comment 9 Sebastian Zarnekow CLA 2011-10-25 07:07:52 EDT
Created attachment 205905 [details]
Uploaded projects with successfully generated parsers

I used your grammar in a fresh Xtext project, set the encoding to Cp1252 and generated the language. Everything works as expected. Xtext build qualifier is 2.1.0.v201110242028 (build id N201110242028)
Comment 10 Sebastian Zarnekow CLA 2011-10-25 07:08:29 EDT
Tried this on another machine, too. Works like a charm. Please attach a complete project that allows to reproduce the problem reliably.
Comment 11 Mahmoud Moneeb CLA 2011-10-25 09:07:55 EDT
(In reply to comment #10)
> Tried this on another machine, too. Works like a charm. Please attach a
> complete project that allows to reproduce the problem reliably.

Thanks Sebastian,

I found my problem was in the configuration mwe2 file some options was overwritten .

Best regards,
Mahmoud