eclipse / xtext

Eclipse Xtext™ is a language development framework
http://www.eclipse.org/Xtext
Eclipse Public License 2.0
769 stars 321 forks source link

java.lang.AssertionError when editing Xtext files in the Git Compare view #2446

Open miklossy opened 5 years ago

miklossy commented 5 years ago

I also noticed an exception

java.lang.AssertionError: '_new!=null && old!=null && !old.getURI().equals(_new.getURI())' constraint violated, old was platform:/resource/Foo/src/foo/Foo.xtend new was: revision:/Foo.xtend
    at org.eclipse.xtext.resource.impl.DefaultResourceDescriptionDelta.<init>(DefaultResourceDescriptionDelta.java:35)
    at org.eclipse.xtext.resource.impl.DefaultResourceDescriptionManager.createDelta(DefaultResourceDescriptionManager.java:69)
    at org.eclipse.xtext.ui.editor.DirtyStateResourceDescription$Manager.createDelta(DirtyStateResourceDescription.java:85)
    at org.eclipse.xtext.ui.editor.DirtyStateEditorSupport.haveEObjectDescriptionsChanged(DirtyStateEditorSupport.java:626)
    at org.eclipse.xtext.ui.editor.DirtyStateEditorSupport.announceDirtyState(DirtyStateEditorSupport.java:536)
    at org.eclipse.xtext.ui.editor.reconciler.XtextDocumentReconcileStrategy.postParse(XtextDocumentReconcileStrategy.java:211)
    at org.eclipse.xtext.ui.editor.reconciler.XtextDocumentReconcileStrategy.doReconcile(XtextDocumentReconcileStrategy.java:185)
    at org.eclipse.xtext.ui.editor.reconciler.XtextDocumentReconcileStrategy.reconcile(XtextDocumentReconcileStrategy.java:90)
    at org.eclipse.xtext.ui.editor.reconciler.XtextReconciler.doRun(XtextReconciler.java:450)
    at org.eclipse.xtext.ui.editor.reconciler.XtextReconciler.access$3(XtextReconciler.java:430)
    at org.eclipse.xtext.ui.editor.reconciler.XtextReconciler$1.process(XtextReconciler.java:364)
    at org.eclipse.xtext.ui.editor.reconciler.XtextReconciler$1.process(XtextReconciler.java:1)
    at org.eclipse.xtext.util.concurrent.IUnitOfWork$Void.exec(IUnitOfWork.java:37)
    at org.eclipse.xtext.resource.OutdatedStateManager.exec(OutdatedStateManager.java:91)
    at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.modify(XtextDocument.java:434)
    at org.eclipse.xtext.ui.editor.model.XtextDocument.internalModify(XtextDocument.java:167)
    at org.eclipse.xtext.ui.editor.reconciler.XtextReconciler.run(XtextReconciler.java:361)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

while editing an Xtend file in the compare view: screencast

tomaswolf commented 5 years ago

This is a comparison of a file from a commit with the current working tree.

Cannot reproduce in Eclipse 2018-12 with Xtext 2.16.0 and EGit nightly.

Cannot reproduce in Eclipse 2019-03 with Xtext 2.17.0 and EGit 5.3.0.

Compare my comments in eclipse/xtext-eclipse#1009; I would expect this be fixed by the EGit 5.3.0 changes especially if that file Foo.xtend was not in the Eclipse workspace (project not imported).

cdietrich commented 5 years ago

i cannot reproduce this neither @miklossy can you please retest with 2019-03 and Xtext 2.17 / EGit 5.3 (i used the RC1 dsl distro from here https://www.eclipse.org/downloads/packages/release/2019-03

miklossy commented 5 years ago

I can reproduce the bug with Eclipse 2018-12, Xtext 2.18.v20190316 and EGit 5.2.0. I have the possibility to retest this with Eclipse 2019-03, and EGit 5.3.0. as soon as these components are released.

cdietrich commented 5 years ago

@miklossy release should be out now

miklossy commented 5 years ago

@cdietrich I can still reproduce the problem with Eclipse 2019-09 and EGit 5.3.0 could you please also try to reproduce again? Please note that you have to save the file after editing to see the exception. If it still does not help, click on the Swap Left and Right View button. While trying to investigate the problem, I see two different exceptions:

 java.lang.NullPointerException
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer$ContributorInfo.setDocument(TextMergeViewer.java:662)
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer.updateContent(TextMergeViewer.java:2998)
    at org.eclipse.xtext.ui.compare.DefaultMergeViewer.updateContent(DefaultMergeViewer.java:95)
    at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.internalRefresh(ContentMergeViewer.java:794)
    at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.refresh(ContentMergeViewer.java:770)
    at org.eclipse.jface.viewers.ContentViewer.setContentProvider(ContentViewer.java:254)
    at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.setContentProvider(ContentMergeViewer.java:541)
    at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.updateContentProvider(ContentMergeViewer.java:545)
    at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.lambda$3(ContentMergeViewer.java:400)
    at org.eclipse.ui.preferences.ScopedPreferenceStore$2.run(ScopedPreferenceStore.java:348)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.ui.preferences.ScopedPreferenceStore.firePropertyChangeEvent(ScopedPreferenceStore.java:345)
    at org.eclipse.ui.preferences.ScopedPreferenceStore.setValue(ScopedPreferenceStore.java:655)
    at org.eclipse.compare.contentmergeviewer.ContentMergeViewer$2.run(ContentMergeViewer.java:919)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:568)
    at org.eclipse.jface.action.ActionContributionItem.lambda$5(ActionContributionItem.java:439)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4131)
java.lang.IllegalStateException: Cannot disconnect document that is not connected
    at org.eclipse.xtext.ui.editor.DocumentBasedDirtyResource.disconnect(DocumentBasedDirtyResource.java:69)
    at org.eclipse.xtext.ui.editor.DirtyStateEditorSupport.removeDirtyStateSupport(DirtyStateEditorSupport.java:466)
    at org.eclipse.xtext.ui.editor.XtextEditor.dispose(XtextEditor.java:584)
    at org.eclipse.xtext.ui.compare.DefaultMergeViewer.disposeEditors(DefaultMergeViewer.java:138)
    at org.eclipse.xtext.ui.compare.DefaultMergeViewer.handleDispose(DefaultMergeViewer.java:129)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:127)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4131)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1055)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1060)
    at org.eclipse.swt.widgets.Widget.release(Widget.java:812)
    at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:931)
    at org.eclipse.swt.widgets.Widget.release(Widget.java:815)
    at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:931)
    at org.eclipse.swt.widgets.Widget.release(Widget.java:815)
    at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:931)
    at org.eclipse.swt.widgets.Widget.release(Widget.java:815)
    at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:931)
    at org.eclipse.swt.widgets.Widget.release(Widget.java:815)
cdietrich commented 5 years ago

indeed problem is still there in the "swap" usecase (local on the right)

An internal error occurred during: "XtextReconcilerJob". '_new!=null && old!=null && !old.getURI().equals(_new.getURI())' constraint violated, old was revision:/Demo.xtend new was: platform:/resource/a/src/b/Demo.xtend

cdietrich commented 5 years ago

fTextWidget is null in TextViewer, but why (looks like fSourceViewer in TextMergeViewer is an old instance that is kept (as a document listener)

cdietrich commented 5 years ago

@miklossy if you restart: does it happen on swap only?

miklossy commented 5 years ago

yes

cdietrich commented 5 years ago

=> there is something wrong with swap and then the state is corrupt permanently cause old listeners

kthoms commented 5 years ago

@miklossy Does this still happen with 2019-06/09 ? With https://git.eclipse.org/r/#/c/148467/ it is planned to change the default direction of compare views, so we should make sure that this does not make the problem more likely.

cdietrich commented 5 years ago

well we dont know if the problem is caused by switching or the intial direction. i thought its cause by switching 6 month ago

miklossy commented 5 years ago

@kthoms Switching the default direction of compare views is a very good idea, please go ahead! If that change makes this problem more likely, it is more likely that it gets fixed!