Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344616 - Some sequences of highlighting positions causes assertion exceptions
Summary: Some sequences of highlighting positions causes assertion exceptions
Status: VERIFIED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: RC1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-03 13:33 EDT by Henrik Lindberg CLA
Modified: 2011-05-05 07:59 EDT (History)
1 user (show)

See Also:
sebastian.zarnekow: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik Lindberg CLA 2011-05-03 13:33:06 EDT
Some sequences of highlighting causes AssertionFailedExceptions during editing or when trying to open the file. The exception when opening the file is also misleading. Stack traces below for both cases.

I keep getting this error/stacktrace for a sequence of highlighting positions. And I tracked the problem down to when the MergingHighlightedPositionAcceptor is performing a merge.  It performs this:
        Assert.isTrue(length >= 0);
when the assert exception is triggered, so the merge must have computed a negative length.

Here are the positions passed:

WORKING SEQUENCE:

offset: 7 length: 17
offset: 29 length: 5
offset: 30 length: 4
offset: 38 length: 13
offset: 39 length: 12
offset: 54 length: 12
offset: 70 length: 13
offset: 71 length: 12
offset: 86 length: 7
offset: 97 length: 8
offset: 98 length: 7
offset: 120 length: 4
offset: 127 length: 1
offset: 130 length: 12
offset: 130 length: 12
offset: 143 length: 1
offset: 146 length: 12
offset: 146 length: 12
offset: 159 length: 1
offset: 162 length: 4
offset: 162 length: 4
offset: 167 length: 1
offset: 120 length: 4

NON WORKING SEQUENCE: 
offset: 7 length: 17
offset: 29 length: 5
offset: 30 length: 4
offset: 38 length: 13
offset: 39 length: 12
offset: 54 length: 12
offset: 70 length: 13
offset: 71 length: 12
offset: 86 length: 7
offset: 97 length: 8
offset: 98 length: 7
offset: 120 length: 4
offset: 127 length: 1
offset: 130 length: 12
offset: 130 length: 12
offset: 143 length: 1
offset: 146 length: 12
offset: 146 length: 12
offset: 159 length: 1
offset: 162 length: 4
offset: 162 length: 4
offset: 167 length: 1
offset: 120 length: 4
offset: 127 length: 41

And for completeness, here is the source being formatted.
define yum::server::repo (
  $path,
  $buildcommand = 'createrepo',
  $buildoptions = '-C -p',
  $rebuild = true,
) {
  cron { "${buildcommand} ${buildoptions} ${path}":

  }
}

- henrik

EXCEPTION WHILE EDITING
=======================
org.eclipse.core.runtime.AssertionFailedException: assertion failed:
    at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110)
    at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96)
    at org.eclipse.jface.text.Position.<init>(Position.java:63)
    at org.eclipse.xtext.ui.editor.syntaxcoloring.AttributedPosition.<init>(AttributedPosition.java:32)
    at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingPresenter.createHighlightedPosition(HighlightingPresenter.java:270)
    at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingReconciler.addPosition(HighlightingReconciler.java:124)
    at org.eclipse.xtext.ui.editor.syntaxcoloring.MergingHighlightedPositionAcceptor.provideHighlightingFor(MergingHighlightedPositionAcceptor.java:51)
    at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingReconciler.reconcilePositions(HighlightingReconciler.java:87)
    at org.eclipse.xtext.ui.editor.syntaxcoloring.HighlightingReconciler.modelChanged(HighlightingReconciler.java:275)
    at org.eclipse.xtext.ui.editor.model.XtextDocument.notifyModelListeners(XtextDocument.java:126)
    at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.afterModify(XtextDocument.java:180)
    at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.afterModify(XtextDocument.java:1)
    at org.eclipse.xtext.util.concurrent.AbstractReadWriteAcces.modify(AbstractReadWriteAcces.java:50)
    at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.modify(XtextDocument.java:187)
    at org.eclipse.xtext.ui.editor.model.XtextDocument.internalModify(XtextDocument.java:98)
    at org.eclipse.xtext.ui.editor.reconciler.XtextDocumentReconcileStrategy.reconcile(XtextDocumentReconcileStrategy.java:33)
    at org.eclipse.xtext.ui.editor.reconciler.XtextReconciler.run(XtextReconciler.java:239)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)


EXCEPTION WHEN OPENING FILE
===========================
org.eclipse.core.runtime.AssertionFailedException: unknown saveable: org.eclipse.ui.internal.DefaultSaveable@4b7ae6a5 from part: org.eclipse.ui.internal.ErrorEditorPart@4b7ae6a5
    at org.eclipse.ui.internal.SaveablesList.logWarning(SaveablesList.java:187)
    at org.eclipse.ui.internal.SaveablesList.addModel(SaveablesList.java:117)
    at org.eclipse.ui.internal.SaveablesList.addModels(SaveablesList.java:289)
    at org.eclipse.ui.internal.SaveablesList.postOpen(SaveablesList.java:684)
    at org.eclipse.ui.internal.PartList.partOpened(PartList.java:234)
    at org.eclipse.ui.internal.PartList.access$0(PartList.java:210)
    at org.eclipse.ui.internal.PartList$1.propertyChanged(PartList.java:40)
    at org.eclipse.ui.internal.WorkbenchPartReference.fireInternalPropertyChange(WorkbenchPartReference.java:375)
    at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:610)
    at org.eclipse.ui.internal.EditorAreaHelper.setVisibleEditor(EditorAreaHelper.java:271)
    at org.eclipse.ui.internal.EditorManager.setVisibleEditor(EditorManager.java:1429)
    at org.eclipse.ui.internal.EditorManager$5.runWithException(EditorManager.java:942)
    at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3593)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3286)
    at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
    at org.eclipse.ui.internal.Workbench$31.runWithException(Workbench.java:1567)
    at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3593)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3286)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2548)
    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:620)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1384)
Comment 1 Sebastian Zarnekow CLA 2011-05-04 10:21:40 EDT
Pushed to master.
Comment 2 Henrik Lindberg CLA 2011-05-04 10:57:35 EDT
(In reply to comment #1)
> Pushed to master.

Thanks for the superfast turnaround!
Comment 3 Henrik Lindberg CLA 2011-05-05 07:59:19 EDT
And it works fine now.