Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaIndenter: BadLocationException logged when pasting string after a "+" #1955

Open
jukzi opened this issue Jan 20, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@jukzi
Copy link
Contributor

jukzi commented Jan 20, 2025

to reproduce:

create HelloWorl.java:

public class HelloWorld {
	public static void main(String[] args) {
		System.out.println("hello"); // <- toggle TracePoint
	}
}

Create a tracpoint and edit it by entering + and then paste anything

Image

null
org.eclipse.jdt.ui
Error
Mon Jan 20 16:42:28 CET 2025
Internal Error

org.eclipse.jface.text.BadLocationException: -1
	at org.eclipse.jface.text.TreeLineTracker.offsetByLine(TreeLineTracker.java:335)
	at org.eclipse.jface.text.TreeLineTracker.getLineOffset(TreeLineTracker.java:1101)
	at org.eclipse.jface.text.AbstractLineTracker.getLineOffset(AbstractLineTracker.java:252)
	at org.eclipse.jface.text.AbstractDocument.getLineOffset(AbstractDocument.java:868)
	at org.eclipse.jdt.internal.ui.text.JavaIndenter.findReferencePosition(JavaIndenter.java:1130)
	at org.eclipse.jdt.internal.ui.text.JavaIndenter.findReferencePosition(JavaIndenter.java:822)
	at org.eclipse.jdt.internal.ui.text.JavaIndenter.findReferencePosition(JavaIndenter.java:696)
	at org.eclipse.jdt.internal.ui.text.java.JavaAutoIndentStrategy.smartPaste(JavaAutoIndentStrategy.java:668)
	at org.eclipse.jdt.internal.ui.text.java.JavaAutoIndentStrategy.customizeDocumentCommand(JavaAutoIndentStrategy.java:1263)
	at org.eclipse.jface.text.TextViewer.customizeDocumentCommand(TextViewer.java:3715)
	at org.eclipse.jface.text.TextViewer.handleVerifyEvent(TextViewer.java:3750)
	at org.eclipse.jface.text.TextViewer$TextVerifyListener.verifyText(TextViewer.java:428)
	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:311)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4304)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1208)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1232)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1217)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:854)
	at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:7099)
	at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:8031)
	at org.eclipse.swt.custom.StyledText.paste(StyledText.java:7205)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.ui.internal.handlers.WidgetMethodHandler.execute(WidgetMethodHandler.java:119)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:277)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:98)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:299)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:233)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:174)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:165)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:485)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:204)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:308)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:569)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:644)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:439)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:96)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1334)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1207)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1232)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1217)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1259)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1255)
	at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1738)
	at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:4886)
	at org.eclipse.swt.widgets.Canvas.WM_CHAR(Canvas.java:347)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4763)
	at org.eclipse.swt.widgets.Canvas.windowProc(Canvas.java:342)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:5072)
	at org.eclipse.swt.internal.win32.OS.DispatchMessage(Native Method)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3688)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1151)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1042)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:665)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:573)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:178)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:668)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:605)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1481)


@jukzi jukzi added the bug Something isn't working label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant