Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360675

Summary: Exception in PartialClassExtractor when using classSplitting
Product: [Modeling] TMF Reporter: Ingo Meyer <ingo.meyer>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sebastian.zarnekow
Version: unspecifiedFlags: sebastian.zarnekow: indigo+
Target Milestone: SR2   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Ingo Meyer CLA 2011-10-12 11:00:09 EDT
Build Identifier: 2.1.0.v201110111926

I get an exception when running the Xtext workflow with the following settings:

fragment = parser.antlr.XtextAntlrUiGeneratorFragment {
	options = {
		classSplitting = true
		fieldsPerClass = "2500"
	}
	antlrParam = "-Xconversiontimeout"
	antlrParam = "60000"				
}


134543 ERROR CompositeGeneratorFragment - String index out of range: -903
java.lang.StringIndexOutOfBoundsException: String index out of range: -903
	at java.lang.String.substring(String.java:1937)
	at org.eclipse.xtext.generator.parser.antlr.splitting.PartialClassExtractor.getTokenDefinitions(PartialClassExtractor.java:148)
	at org.eclipse.xtext.generator.parser.antlr.splitting.PartialClassExtractor.transform(PartialClassExtractor.java:64)
	at org.eclipse.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment.splitParserClassFile(AbstractAntlrGeneratorFragment.java:104)
	at org.eclipse.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment.splitParserAndLexerIfEnabled(AbstractAntlrGeneratorFragment.java:156)
	at org.eclipse.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment.splitParserAndLexerIfEnabled(AbstractAntlrGeneratorFragment.java:164)
	at org.eclipse.xtext.generator.parser.antlr.XtextAntlrUiGeneratorFragment.generate(XtextAntlrUiGeneratorFragment.java:52)
	at org.eclipse.xtext.generator.CompositeGeneratorFragment.generate(CompositeGeneratorFragment.java:81)
	at org.eclipse.xtext.generator.LanguageConfig.generate(LanguageConfig.java:102)
	at org.eclipse.xtext.generator.Generator.generate(Generator.java:351)
	at org.eclipse.xtext.generator.Generator.invokeInternal(Generator.java:125)
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
	at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
	at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
	at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:97)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:64)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:55)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)


Reproducible: Always
Comment 1 Sebastian Zarnekow CLA 2011-10-12 11:02:17 EDT
Please provide a reproducable example.
Comment 2 Ingo Meyer CLA 2011-10-12 11:17:04 EDT
(In reply to comment #1)
> Please provide a reproducable example.

Hmm, the grammar is not public, but actually it is huge.
If the stacktrace doesn't help I will investigate a bit further...
Comment 3 Sebastian Zarnekow CLA 2011-10-12 11:24:10 EDT
There was another fix in the *Extractor which will be available in the next nightly. You may want to try that. If it fails again, please post the updated stacktrace.
Comment 4 Sebastian Zarnekow CLA 2011-10-12 11:24:43 EDT
Btw: Does it fail without those options?

antlrParam = "-Xconversiontimeout"
antlrParam = "60000"
Comment 5 Sebastian Zarnekow CLA 2011-10-12 14:33:24 EDT
Are you on a windows box?
Comment 6 Ingo Meyer CLA 2011-10-12 14:51:43 EDT
(In reply to comment #5)
> Are you on a windows box?

Yes, Win 7, Eclipse 20110609-2236, and the 2 antlrParams doesn't change it.
I will try the next nightly and post the results back here
Comment 7 Sebastian Zarnekow CLA 2011-10-12 14:53:22 EDT
It's a line.separator issue. The code assumed that \n is used but Antlr generates \r\n on windows.
Comment 8 Ingo Meyer CLA 2011-10-12 14:55:22 EDT
(In reply to comment #7)
> It's a line.separator issue. The code assumed that \n is used but Antlr
> generates \r\n on windows.

Ah, ok, I see. Is this the change you where talking about for the next nightly?
Comment 9 Sebastian Zarnekow CLA 2011-10-12 14:59:23 EDT
Unfortunately not. I'll keep you posted.
Comment 10 Sebastian Zarnekow CLA 2011-10-12 15:01:28 EDT
Pushed fix to master. Please reopen if the problem persists with the next nightly build.
Comment 11 Karsten Thoms CLA 2017-09-19 17:41:17 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 12 Karsten Thoms CLA 2017-09-19 17:52:25 EDT
Closing all bugs that were set to RESOLVED before Neon.0