Bug 75264 [typing] BadLocationException with LinkedCorrectionProposal
I200409281200 public class MyClass { public MyClass(Comparable theThing) { } } - set caret into theThing - invoke QuickAssist and apply "Assign parameter to new Field" - press Tab => This stacktrace goes to the log 3 times: org.eclipse.jface.text.BadLocationException at org.eclipse.jface.text.AbstractDocument.get(AbstractDocument.java:904) at org.eclipse.jdt.internal.ui.javaeditor.PartiallySynchronizedDocument.get(PartiallySynchronizedDocument.java:74) at org.eclipse.jdt.internal.ui.text.correction.LinkedCorrectionProposal$LinkedModeProposal.validate(LinkedCorrectionProposal.java:429) at org.eclipse.jface.internal.text.link.contentassist.CompletionProposalPopup2.validateProposal(CompletionProposalPopup2.java:582) at org.eclipse.jface.internal.text.link.contentassist.CompletionProposalPopup2.setProposals(CompletionProposalPopup2.java:525) at org.eclipse.jface.internal.text.link.contentassist.CompletionProposalPopup2.showProposals(CompletionProposalPopup2.java:201) at org.eclipse.jface.internal.text.link.contentassist.ContentAssistant2.showPossibleCompletions(ContentAssistant2.java:1298) at org.eclipse.jface.text.link.LinkedModeUI.triggerContentAssist(LinkedModeUI.java:807) at org.eclipse.jface.text.link.LinkedModeUI.switchPosition(LinkedModeUI.java:843) at org.eclipse.jface.text.link.LinkedModeUI.next(LinkedModeUI.java:778) at org.eclipse.jface.text.link.LinkedModeUI$KeyListener.verifyKey(LinkedModeUI.java:447) at org.eclipse.jface.text.TextViewer$VerifyKeyListenersManager.verifyKey(TextViewer.java:404) at org.eclipse.swt.custom.StyledTextListener.handleEvent(StyledTextListener.java:55) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:805) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:613) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5000) at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:4747) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:796) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:820) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:805) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1736) at org.eclipse.swt.widgets.Control.sendKeyEvent(Control.java:1732) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3073) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2975) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3351) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1488) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2441) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1443) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1414) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:271) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:144) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:102) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:335) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:273) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:129) 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:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:185) at org.eclipse.core.launcher.Main.run(Main.java:704) at org.eclipse.core.launcher.Main.main(Main.java:688)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/LinkedCorrectionProposal.java
* @see org.eclipse.jface.text.contentassist.ICompletionProposalExtension2#apply(org.eclipse.jface.text.ITextViewer, char, int, int)
		 */
		public void apply(ITextViewer viewer, char trigger, int stateMask, int offset) {
			IDocument document= viewer.getDocument();
			try {
				String replaceString= fProposal;
				ImportsStructure impStructure= null;
				if (fTypeProposal != null) {
					impStructure= getImportStructure();
					replaceString= impStructure.addImport(fTypeProposal);
				}
				int off, length;
				if (fPosition != null) {
					off= fPosition.getOffset();
					length= fPosition.getLength();
				} else {
					Point point= viewer.getSelectedRange();
					off= point.x;
					length= point.y;
				}
				document.replace(off, length, replaceString);
			
				if (impStructure != null) {
					impStructure.create(false, null);
				}
			} catch (BadLocationException e) {
				JavaPlugin.log(e);
			} catch (CoreException e) {
				JavaPlugin.log(e);
			}