Community
Participate
Working Groups
HEAD Linked mode does not work with Unicode escapes. E.g try the 'Rename in file' quick fix or the Rename refactoring (in lightweight mode) on 'B' here: public class B { public static \u0042 newInstance() { return new \u0042(); } } LinkedPositionGroup throws an exception because 'B' and '\u0042' don't have the same length and are considered to be different. org.eclipse.jface.text.BadLocationException: First position: 'B' at 25, this position: '\u0042' at 45 at org.eclipse.jface.text.link.LinkedPositionGroup.enforceEqualContent(LinkedPositionGroup.java:130) at org.eclipse.jface.text.link.LinkedPositionGroup.addPosition(LinkedPositionGroup.java:111) at org.eclipse.jdt.internal.ui.text.correction.LinkedNamesAssistProposal.apply(LinkedNamesAssistProposal.java:127) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertProposal(CompletionProposalPopup.java:806) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.insertSelectedProposalWithMask(CompletionProposalPopup.java:757) at org.eclipse.jface.text.contentassist.CompletionProposalPopup.verifyKey(CompletionProposalPopup.java:1164) at org.eclipse.jface.text.contentassist.ContentAssistant$InternalListener.verifyKey(ContentAssistant.java:786) at org.eclipse.jface.text.TextViewer$VerifyKeyListenersManager.verifyKey(TextViewer.java:460) at org.eclipse.swt.custom.StyledTextListener.handleEvent(StyledTextListener.java:60) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:962) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:706) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5047) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:4795) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:962) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:947) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:975) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:971) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1285) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3762) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3662) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4342) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2226) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3282) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2361) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2325) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:101) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:152) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:359) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:174) 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:476) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:416) at org.eclipse.equinox.launcher.Main.run(Main.java:1141) at org.eclipse.equinox.launcher.Main.main(Main.java:1116)
Created attachment 246962 [details] Fix
I don't think it's the link mode's job to ensure all positions have "equal" content. If an API client has a better understanding of "equal", then we should not block it. This patch also fixes bug 429221. Dani, is this OK for you? We could increase the version of org.eclipse.text to 3.6 to account for the externally visible behavior change, but OTOH, I don't think anybody should have relied on the BadLocationException that is no longer thrown.
*** Bug 429221 has been marked as a duplicate of this bug. ***
(In reply to Markus Keller from comment #2) > I don't think it's the link mode's job to ensure all positions have "equal" > content. If an API client has a better understanding of "equal", then we > should not block it. This patch also fixes bug 429221. > > Dani, is this OK for you? Yes, with the changes to the Javadoc that we just discussed. > We could increase the version of org.eclipse.text to 3.6 to account for the > externally visible behavior change, but OTOH, I don't think anybody should > have relied on the BadLocationException that is no longer thrown. I agree.
Fixed with http://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=76a4576bcc03624b248334e9eeafabdc500b3428