Community
Participate
Working Groups
Build Identifier: 20100917-0705 At some places in the editor, when trying to get content assist at a spot where it should be looking for an external reference, the content assist throws NPE. Debugger investigation showed that BaseRecognizer.following[99] = null, whereas higher indexes are not, and BaseRecognizer._fsp > 100 !ENTRY org.eclipse.ui 4 4 2010-09-29 12:09:06.382 !MESSAGE "Content Assist" did not complete normally. Please see the log for more information. !ENTRY org.eclipse.ui 4 0 2010-09-29 12:09:06.398 !MESSAGE java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at org.antlr.runtime.BaseRecognizer.combineFollows(BaseRecognizer.java:457) at org.antlr.runtime.BaseRecognizer.computeContextSensitiveRuleFOLLOW(BaseRecognizer.java:444) at org.antlr.runtime.BaseRecognizer.recoverFromMismatchedElement(BaseRecognizer.java:546) at org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser.recoverFromMismatchedToken(AbstractInternalContentAssistParser.java:182) at org.antlr.runtime.BaseRecognizer.mismatch(BaseRecognizer.java:119) at org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser.mismatch(AbstractInternalContentAssistParser.java:354) at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:99) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RANRef__RefAssignment_2(InternalCheckParser.java:28064) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RANRef__Group__2__Impl(InternalCheckParser.java:22932) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RANRef__Group__2(InternalCheckParser.java:22893) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RANRef__Group__1(InternalCheckParser.java:22800) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RANRef__Group__0(InternalCheckParser.java:22727) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleRANRef(InternalCheckParser.java:2284) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RanChain__RefAssignment_2(InternalCheckParser.java:27784) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RanChain__Group__2__Impl(InternalCheckParser.java:21089) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RanChain__Group__2(InternalCheckParser.java:21046) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RanChain__Group__1(InternalCheckParser.java:20957) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RanChain__Group__0(InternalCheckParser.java:20875) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleRanChain(InternalCheckParser.java:2134) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RANExp__NextAssignment_2_4(InternalCheckParser.java:27699) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RANExp__Group_2__4__Impl(InternalCheckParser.java:20829) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RANExp__Group_2__4(InternalCheckParser.java:20782) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RANExp__Group_2__3(InternalCheckParser.java:20693) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RANExp__Group_2__2(InternalCheckParser.java:20611) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RANExp__Group_2__1(InternalCheckParser.java:20518) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RANExp__Group_2__0(InternalCheckParser.java:20445) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RANExp__Alternatives(InternalCheckParser.java:4473) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleRANExp(InternalCheckParser.java:2059) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Primary__Alternatives(InternalCheckParser.java:4241) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rulePrimary(InternalCheckParser.java:1984) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__SetExpression__Alternatives(InternalCheckParser.java:3976) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleSetExpression(InternalCheckParser.java:1909) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__UnaryExpression__Alternatives(InternalCheckParser.java:3849) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleunaryExpression(InternalCheckParser.java:1834) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__ExponentExpression__Group__0__Impl(InternalCheckParser.java:17364) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__ExponentExpression__Group__0(InternalCheckParser.java:17324) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleExponentExpression(InternalCheckParser.java:1759) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__MultiplicativeExpression__Group__0__Impl(InternalCheckParser.java:16428) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__MultiplicativeExpression__Group__0(InternalCheckParser.java:16388) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rulemultiplicativeExpression(InternalCheckParser.java:1684) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__AdditiveExpression__Group__0__Impl(InternalCheckParser.java:15794) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__AdditiveExpression__Group__0(InternalCheckParser.java:15754) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleadditiveExpression(InternalCheckParser.java:1609) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__ShiftExpression__Group__0__Impl(InternalCheckParser.java:15160) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__ShiftExpression__Group__0(InternalCheckParser.java:15120) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleshiftExpression(InternalCheckParser.java:1534) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RelationalExpression__Group__0__Impl(InternalCheckParser.java:14089) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__RelationalExpression__Group__0(InternalCheckParser.java:14049) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rulerelationalExpression(InternalCheckParser.java:1459) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__InstanceOfExpression__Group__0__Impl(InternalCheckParser.java:13691) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__InstanceOfExpression__Group__0(InternalCheckParser.java:13651) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleinstanceOfExpression(InternalCheckParser.java:1384) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__EqualityExpression__Group__0__Impl(InternalCheckParser.java:13064) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__EqualityExpression__Group__0(InternalCheckParser.java:13024) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleEqualityExpression(InternalCheckParser.java:1309) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__BitwiseAndExpression__Group__0__Impl(InternalCheckParser.java:12659) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__BitwiseAndExpression__Group__0(InternalCheckParser.java:12619) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleBitwiseAndExpression(InternalCheckParser.java:1234) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__BitwiseXorExpression__Group__0__Impl(InternalCheckParser.java:12254) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__BitwiseXorExpression__Group__0(InternalCheckParser.java:12214) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleBitwiseXorExpression(InternalCheckParser.java:1159) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__BitwiseOrExpression__Group__0__Impl(InternalCheckParser.java:11849) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__BitwiseOrExpression__Group__0(InternalCheckParser.java:11809) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleBitwiseOrExpression(InternalCheckParser.java:1084) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__AndExpression__Group__0__Impl(InternalCheckParser.java:11444) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__AndExpression__Group__0(InternalCheckParser.java:11404) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleAndExpression(InternalCheckParser.java:1009) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__OrExpression__Group__0__Impl(InternalCheckParser.java:11039) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__OrExpression__Group__0(InternalCheckParser.java:10999) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleOrExpression(InternalCheckParser.java:934) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleExpression(InternalCheckParser.java:862) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__VarDef__ValAssignment_2(InternalCheckParser.java:25421) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__VarDef__Group__2__Impl(InternalCheckParser.java:10891) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__VarDef__Group__2(InternalCheckParser.java:10848) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__VarDef__Group__1(InternalCheckParser.java:10779) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__VarDef__Group__0(InternalCheckParser.java:10697) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleVarDef(InternalCheckParser.java:790) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__CheckStatement__Alternatives(InternalCheckParser.java:3064) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleCheckStatement(InternalCheckParser.java:340) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__PseudoCode__StaAssignment_1(InternalCheckParser.java:24870) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__PseudoCode__Alternatives(InternalCheckParser.java:2895) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rulePseudoCode(InternalCheckParser.java:265) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__PscAssignment_18(InternalCheckParser.java:24782) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__18__Impl(InternalCheckParser.java:7146) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__18(InternalCheckParser.java:7103) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__17(InternalCheckParser.java:7034) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__16(InternalCheckParser.java:6941) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__15(InternalCheckParser.java:6817) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__14(InternalCheckParser.java:6744) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__13(InternalCheckParser.java:6620) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__12(InternalCheckParser.java:6547) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__11(InternalCheckParser.java:6465) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__10(InternalCheckParser.java:6392) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__9(InternalCheckParser.java:6310) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__8(InternalCheckParser.java:6237) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__7(InternalCheckParser.java:6144) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__6(InternalCheckParser.java:6051) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__5(InternalCheckParser.java:5969) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__4(InternalCheckParser.java:5896) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__3(InternalCheckParser.java:5814) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__2(InternalCheckParser.java:5741) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__1(InternalCheckParser.java:5659) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__Check__Group__0(InternalCheckParser.java:5586) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleCheck(InternalCheckParser.java:190) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__AllDefs__ChksAssignment_4(InternalCheckParser.java:24348) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__AllDefs__Group__4__Impl(InternalCheckParser.java:5504) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__AllDefs__Group__4(InternalCheckParser.java:5462) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__AllDefs__Group__3(InternalCheckParser.java:5384) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__AllDefs__Group__2(InternalCheckParser.java:5311) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__AllDefs__Group__1(InternalCheckParser.java:5229) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.rule__AllDefs__Group__0(InternalCheckParser.java:5156) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.ruleAllDefs(InternalCheckParser.java:115) at wide.xtext.ui.contentassist.antlr.internal.InternalCheckParser.entryRuleAllDefs(InternalCheckParser.java:77) at wide.xtext.ui.contentassist.antlr.CheckParser.getFollowElements(CheckParser.java:256) at org.eclipse.xtext.ui.editor.contentassist.antlr.AbstractContentAssistParser.getFollowElements(AbstractContentAssistParser.java:220) at org.eclipse.xtext.ui.editor.contentassist.antlr.ParserBasedContentAssistContextFactory.create(ParserBasedContentAssistContextFactory.java:128) at org.eclipse.xtext.ui.editor.contentassist.CompletionProposalComputer.exec(CompletionProposalComputer.java:48) at org.eclipse.xtext.ui.editor.contentassist.CompletionProposalComputer.exec(CompletionProposalComputer.java:1) at org.eclipse.xtext.util.concurrent.IStateAccess$AbstractImpl.readOnly(IStateAccess.java:40) at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:70) at org.eclipse.xtext.ui.editor.contentassist.XtextContentAssistProcessor.computeCompletionProposals(XtextContentAssistProcessor.java:79) at org.eclipse.jface.text.contentassist.ContentAssistant.computeCompletionProposals(ContentAssistant.java:1834) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.computeProposals(CompletionProposalPopup.java:556) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.access$16(CompletionProposalPopup.java:553) at org.eclipse.jface.text.contentassist.CompletionProposalPopup$2.run(CompletionProposalPopup.java:488) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.showProposals(CompletionProposalPopup.java:482) at org.eclipse.jface.text.contentassist.ContentAssistant.showPossibleCompletions(ContentAssistant.java:1660) at org.eclipse.jface.text.source.SourceViewer.doOperation(SourceViewer.java:919) at org.eclipse.jface.text.source.projection.ProjectionViewer.doOperation(ProjectionViewer.java:1534) at org.eclipse.ui.texteditor.ContentAssistAction$1.run(ContentAssistAction.java:82) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.texteditor.ContentAssistAction.run(ContentAssistAction.java:80) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:185) at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:109) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508) at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:468) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:786) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:885) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:567) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:508) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:123) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1253) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1052) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1062) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1103) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1099) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1508) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4268) at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:345) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4160) at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:341) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4873) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2459) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3655) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574) at org.eclipse.equinox.launcher.Main.run(Main.java:1407) at org.eclipse.equinox.launcher.Main.main(Main.java:1383) Reproducible: Always
I just ran into the same issue and found the reference to this bug in the tmf newsgroup. This is actually caused by a bug in org.antlr.runtime. Whether you run into this or not depends on the location where you invoke content assist. As you already pointed out, BaseRecognizer.following[99] is null. This array (.following) is supposed to work as a stack, but org.antlr.runtime.BaseRecognizer.pushFollow(BitSet) contains a bug: /** Push a rule's follow set using our own hardcoded stack */ protected void pushFollow(BitSet fset) { if ( (_fsp +1)>=following.length ) { BitSet[] f = new BitSet[following.length*2]; System.arraycopy(following, 0, f, 0, following.length-1); following = f; } following[++_fsp] = fset; } See it? Look closely ... ... ... ;) The problem is the length parameter of System.arraycopy. They do not copy the last element of the original array when growing, that's why following[99] is null and then followed by non-null elements. As long as the stack did not have to grow, you will not run into the NPE. The fix is simple: System.arraycopy(following, 0, f, 0, following.length); I tested this by manually overwriting the method in the Xtext-generated Internal<myLanguage>Parser in the .ui project ==> NPEs are gone. Is there a way to "inject" this change into the Xtext generator? I already tried to use a custom parser class derived from the generated one, but this spoils some reflective method invocations deep down in Xtext (getClass().getDeclaredMethods() fails to return get<rule> methods). I'd really like to work around this without manually changing generated code. I also checked current antlr sources at http://github.com/antlr, the bug does not seem to be present there.
(In reply to comment #1) > [...] but this > spoils some reflective method invocations deep down in Xtext > (getClass().getDeclaredMethods() fails to return get<rule> methods). The methods that are missing are public final EObject rule<ruleName>()
Created attachment 180056 [details] Workaround Added org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser.pushFollow(BitSet) to work around this problem. The patch is against the Helios_Final tag in git (commit 507b5ab3875669f57ad6c62bd1ccba74a7df121d)
Created attachment 180057 [details] Workaround based on v1.0.1 Added org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser.pushFollow(BitSet) to work around this problem. The patch is against the v1.0.1 tag in git (commit 270291576d8cf12bcaa8e65bae26cdf8c9472719)
Thanks for tracking this down. You could add a PostProcessor to the generator in the mwe2 file. The PostProcessorallows you to do modifications to the generated files before they are written to the hard disk. I think for the Xtext 2.0 stream we should solve this by upgrading to a new Antlr version.
I applied the patch, added tests and pushed the fix to master. Thanks for analysing the issue. The fix will be available in Indigio M3.
Is it possible to apply this patch to a service release in the Eclipse 3.6 stream? as my product is based on 3.6. If not, can you show me a way to work around this without having to modify the generated code? I read that you can add a post-processor to modify the generated file. Can you point me to the documentation for that? Sorry, not sure how to do that. Thanks! Samantha
I started a small project containing a workaround for this and another bug. See http://github.com/DanielWeber/xtextext You just have to swap one of the generator fragments and you're done. A few lines of documentation should be coming soon :) In essence: In the your language's .mwe2 file, replace XtextAntlrUiGeneratorFragment with PatchedXtextAntlrUiGeneratorFragment: // fragment = parser.antlr.XtextAntlrUiGeneratorFragment {} fragment = com.github.xtextext.workarounds.parser.PatchedXtextAntlrUiGeneratorFragment {} This will also make your .ui plugin depend on com.github.xtextext.workarounds, so you might have to merge the generated MANIFEST.MF if merging is disabled in the generator.
(In reply to comment #7) > Is it possible to apply this patch to a service release in the Eclipse 3.6 > stream? as my product is based on 3.6. Yes, we'll do
Workaround was removed from Xtext 2.0 stream since we migrated to Antlr 3.2
Applied workaround in Helios_Maintenance
Closing all bugs that were set to RESOLVED before Neon.0