erlang / erlide_eclipse

Eclipse IDE for Erlang

Home Page:http://erlide.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

File comparisons using "Erlang Source Compare" fail

acarstoiu opened this issue · comments

When comparing an Erlang source file to a version stored in Git for a chosen commit (or branch), the compare editor has no contents and this is what I get in log:

!ENTRY org.eclipse.ui 4 0 2016-04-18 15:38:04.212
!MESSAGE Unhandled event loop exception
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.IllegalArgumentException: Argument not valid)
    at org.eclipse.swt.SWT.error(SWT.java:4491)
    at org.eclipse.swt.SWT.error(SWT.java:4406)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:138)
    at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4155)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3772)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:694)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:606)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1488)
Caused by: java.lang.IllegalArgumentException: Argument not valid
    at org.eclipse.swt.SWT.error(SWT.java:4472)
    at org.eclipse.swt.SWT.error(SWT.java:4406)
    at org.eclipse.swt.SWT.error(SWT.java:4377)
    at org.eclipse.swt.custom.StyledText.setStyleRanges(StyledText.java:9885)
    at org.eclipse.swt.custom.StyledText.replaceStyleRanges(StyledText.java:7869)
    at org.eclipse.jface.text.TextViewer.addPresentation(TextViewer.java:4859)
    at org.eclipse.jface.text.TextViewer.changeTextPresentation(TextViewer.java:4938)
    at org.eclipse.jface.text.presentation.PresentationReconciler.applyTextRegionCollection(PresentationReconciler.java:582)
    at org.eclipse.jface.text.presentation.PresentationReconciler.processDamage(PresentationReconciler.java:571)
    at org.eclipse.jface.text.presentation.PresentationReconciler.access$3(PresentationReconciler.java:567)
    at org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.textChanged(PresentationReconciler.java:227)
    at org.eclipse.jface.text.TextViewer.updateTextListeners(TextViewer.java:2826)
    at org.eclipse.jface.text.TextViewer.invalidateTextPresentation(TextViewer.java:3478)
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer.invalidateTextPresentation(TextMergeViewer.java:1703)
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer.doDiff(TextMergeViewer.java:3396)
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer.update(TextMergeViewer.java:5266)
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer.updateContent(TextMergeViewer.java:2904)
    at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.internalRefresh(ContentMergeViewer.java:760)
    at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.inputChanged(ContentMergeViewer.java:660)
    at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:292)
    at org.eclipse.compare.CompareViewerSwitchingPane.setInput(CompareViewerSwitchingPane.java:277)
    at org.eclipse.compare.internal.CompareContentViewerSwitchingPane.setInput(CompareContentViewerSwitchingPane.java:191)
    at org.eclipse.compare.CompareEditorInput.internalSetContentPaneInput(CompareEditorInput.java:845)
    at org.eclipse.compare.CompareEditorInput.feedInput(CompareEditorInput.java:738)
    at org.eclipse.compare.CompareEditorInput.createContents(CompareEditorInput.java:555)
    at org.eclipse.compare.internal.CompareEditor.createCompareControl(CompareEditor.java:462)
    at org.eclipse.compare.internal.CompareEditor.access$6(CompareEditor.java:422)
    at org.eclipse.compare.internal.CompareEditor$3.run(CompareEditor.java:378)
    at org.eclipse.ui.internal.UILockListener.doPendingWork(UILockListener.java:162)
    at org.eclipse.ui.internal.UISynchronizer$3.run(UISynchronizer.java:154)
    at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
    at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
    ... 24 more

In the commit dialogue one has the opportunity to compare the modified files; sometimes the same problem is observed, namely no contents is shown in the compare panel, but If I close it and retry, it works! The difference is that on this occasion only the java.lang.IllegalArgumentException: Argument not valid exception shows up in log:

!ENTRY org.eclipse.ui 4 0 2016-04-18 15:39:37.636
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.IllegalArgumentException: Argument not valid
    at org.eclipse.swt.SWT.error(SWT.java:4472)
    at org.eclipse.swt.SWT.error(SWT.java:4406)
    at org.eclipse.swt.SWT.error(SWT.java:4377)
    at org.eclipse.swt.custom.StyledText.setStyleRanges(StyledText.java:9885)
    at org.eclipse.swt.custom.StyledText.replaceStyleRanges(StyledText.java:7869)
    at org.eclipse.jface.text.TextViewer.addPresentation(TextViewer.java:4859)
    at org.eclipse.jface.text.TextViewer.changeTextPresentation(TextViewer.java:4938)
    at org.eclipse.jface.text.presentation.PresentationReconciler.applyTextRegionCollection(PresentationReconciler.java:582)
    at org.eclipse.jface.text.presentation.PresentationReconciler.processDamage(PresentationReconciler.java:571)
    at org.eclipse.jface.text.presentation.PresentationReconciler.access$3(PresentationReconciler.java:567)
    at org.eclipse.jface.text.presentation.PresentationReconciler$InternalListener.textChanged(PresentationReconciler.java:227)
    at org.eclipse.jface.text.TextViewer.updateTextListeners(TextViewer.java:2826)
    at org.eclipse.jface.text.TextViewer.invalidateTextPresentation(TextViewer.java:3478)
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer.invalidateTextPresentation(TextMergeViewer.java:1701)
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer.doDiff(TextMergeViewer.java:3396)
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer.update(TextMergeViewer.java:5266)
    at org.eclipse.compare.contentmergeviewer.TextMergeViewer.updateContent(TextMergeViewer.java:2904)
    at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.internalRefresh(ContentMergeViewer.java:760)
    at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.inputChanged(ContentMergeViewer.java:660)
    at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:292)
    at org.eclipse.compare.CompareViewerSwitchingPane.setInput(CompareViewerSwitchingPane.java:277)
    at org.eclipse.compare.internal.CompareContentViewerSwitchingPane.setInput(CompareContentViewerSwitchingPane.java:191)
    at org.eclipse.compare.CompareEditorInput.internalSetContentPaneInput(CompareEditorInput.java:845)
    at org.eclipse.compare.CompareEditorInput.feedInput(CompareEditorInput.java:738)
    at org.eclipse.compare.CompareEditorInput.createContents(CompareEditorInput.java:555)
    at org.eclipse.compare.internal.CompareDialog.createDialogArea(CompareDialog.java:175)
    at org.eclipse.jface.dialogs.Dialog.createContents(Dialog.java:768)
    at org.eclipse.jface.window.Window.create(Window.java:430)
    at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1096)
    at org.eclipse.jface.window.Window.open(Window.java:792)
    at org.eclipse.compare.internal.CompareDialog.open(CompareDialog.java:196)
    at org.eclipse.compare.internal.CompareUIPlugin$4.run(CompareUIPlugin.java:1403)
    at org.eclipse.compare.internal.CompareUIPlugin.syncExec(CompareUIPlugin.java:1413)
    at org.eclipse.compare.internal.CompareUIPlugin.internalOpenDialog(CompareUIPlugin.java:1406)
    at org.eclipse.compare.internal.CompareUIPlugin.openCompareDialog(CompareUIPlugin.java:580)
    at org.eclipse.compare.CompareUI.openCompareDialog(CompareUI.java:211)
    at org.eclipse.egit.ui.internal.CompareUtils.compareHeadWithWorkspace(CompareUtils.java:404)
    at org.eclipse.egit.ui.internal.dialogs.CommitDialog.compare(CommitDialog.java:1427)
    at org.eclipse.egit.ui.internal.dialogs.CommitDialog.access$0(CommitDialog.java:1421)
    at org.eclipse.egit.ui.internal.dialogs.CommitDialog$CommitItemSelectionListener.widgetDefaultSelected(CommitDialog.java:315)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:119)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:827)
    at org.eclipse.jface.window.Window.open(Window.java:803)
    at org.eclipse.egit.ui.internal.commit.CommitUI.commit(CommitUI.java:182)
    at org.eclipse.egit.ui.internal.actions.CommitActionHandler.execute(CommitActionHandler.java:80)
    at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:295)
    at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
    at sun.reflect.GeneratedMethodAccessor65.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:252)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:234)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
    at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java:493)
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:486)
    at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:286)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:507)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:558)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:378)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:324)
    at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:86)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1266)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1112)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1137)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1122)
    at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1164)
    at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1160)
    at org.eclipse.swt.widgets.Widget.wmKeyDown(Widget.java:1883)
    at org.eclipse.swt.widgets.Control.WM_KEYDOWN(Control.java:5049)
    at org.eclipse.swt.widgets.Tree.WM_KEYDOWN(Tree.java:6156)
    at org.eclipse.swt.widgets.Control.windowProc(Control.java:4708)
    at org.eclipse.swt.widgets.Tree.windowProc(Tree.java:6024)
    at org.eclipse.swt.widgets.Display.windowProc(Display.java:5063)
    at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
    at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2549)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3767)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:694)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:606)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1488)

This has been an ongoing problem since a long time ago. You suspected that it might have been the file encoding (UTF-8), but it looks like it's more than that.

Thanks. The main issue has been that I could not reproduce this issue. I will try again, maybe I can this time.

For the commit dialogue to show up be sure to uncheck in preferences Team -> Git -> Commiting -> Use Staging View to commit instead of Commit Dialog.
The totally not working case is easily reproduceable by right clicking on a source file, then choosing Compare With -> Branch, Tag, or Reference... .

I believe this is not specific to Git, but I cannot tell for sure.

Is your project public or can you find a public project where you see this issue? I tried now with the rebar project, comparing rebar_ct.erl master with 2.4.0 and it works fine for me.

untitled

My Eclipse is 4.5.2, if that matters, I'm (unfortunately) running on a virtualized Windows 8. I doubt very much that it has anything with the sources.
I reproduced it with lager/src/lager_format.erl, by comparing with branch origin/mra/overload_killer.

Weird, work nicely for me (can't see that exact reference, used origin/mra/gh315), see below.

What's your workspace's encoding? Window->Preferences->General->Workspace

untitled

"Default (cp1252)"

Can you please try to change it to UTF-8?

No difference, still fails. Might be an SWT unsupported stuff in a virtualized environment.

What version of Erlang are you using as backend? Maybe it's a mismatch between how Java and Erlang treat the text (encoding) - the exception occurs because the range reported by Erlang is invalid as seen by Java, probably outside the bounds. The mystery is why it doesn't happen for the regular Erlang editor too... maybe the comparison editor makes different assumptions somewhere?

werl says Erlang/OTP 17 [erts-6.4] [64-bit] [smp:4:4] [async-threads:10].
Eclipse says java.version=1.8.0_77 java.vm.name=Java HotSpot(TM) 64-Bit Server VM.

I do not know what you did in the latest version 0.33 but it finally works 😄 ✨
It has been pissing me off for one and a half years... uh 😌

Out of joy, I forgot to say "multumesc frumos. Ar fi interesant de aflat studiind modificarile si care anume era problema."

The thing is, I didn't do anything about this, not specifically. It has worked before, and it has stopped working just as magically. I did configure all projects as UTF-8, maybe that fixed it. If I could reproduce, I could try to find the exact commit, but I can't.

Cu placere!