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

Upgrade to Eclipse 2020.3 with Java 14 Patch #195

Closed
philwebb opened this issue May 27, 2020 · 8 comments
Closed

Upgrade to Eclipse 2020.3 with Java 14 Patch #195

philwebb opened this issue May 27, 2020 · 8 comments

Comments

@philwebb
Copy link
Contributor

philwebb commented May 27, 2020

Currently the plugin fails with the following:

java.lang.IndexOutOfBoundsException: Index: 1272, Size: 1272
	at java.util.ArrayList.rangeCheck(ArrayList.java:657)
	at java.util.ArrayList.get(ArrayList.java:433)
	at io.spring.javaformat.formatter.eclipse.TokenManager.get(TokenManager.java:75)
	at io.spring.javaformat.formatter.eclipse.TokenManager.findIndex(TokenManager.java:168)
	at io.spring.javaformat.formatter.eclipse.SpacePreparator.handleToken(SpacePreparator.java:1098)
	at io.spring.javaformat.formatter.eclipse.SpacePreparator.visit(SpacePreparator.java:178)
	at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:430)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2971)
	at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:3042)
	at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:258)
	at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2971)
	at io.spring.javaformat.formatter.eclipse.DefaultCodeFormatter.prepareSpaces(DefaultCodeFormatter.java:412)
	at io.spring.javaformat.formatter.eclipse.DefaultCodeFormatter.prepareFormattedCode(DefaultCodeFormatter.java:229)
	at io.spring.javaformat.formatter.eclipse.DefaultCodeFormatter.format(DefaultCodeFormatter.java:186)
	at io.spring.javaformat.formatter.eclipse.DefaultCodeFormatter.format(DefaultCodeFormatter.java:168)
	at io.spring.javaformat.formatter.Formatter.lambda$format$0(Formatter.java:102)
	at io.spring.javaformat.formatter.Formatter.nlsSafe(Formatter.java:149)
	at io.spring.javaformat.formatter.Formatter.format(Formatter.java:101)
	at io.spring.javaformat.eclipse.formatter.SpringCodeFormatter.format(SpringCodeFormatter.java:39)
	at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.reformat(CodeFormatterUtil.java:291)
	at org.eclipse.jdt.internal.corext.util.CodeFormatterUtil.reformat(CodeFormatterUtil.java:354)
	at org.eclipse.jdt.internal.corext.fix.CodeFormatFix.createCleanUp(CodeFormatFix.java:74)
	at org.eclipse.jdt.internal.ui.fix.CodeFormatCleanUp.createFix(CodeFormatCleanUp.java:64)
	at org.eclipse.jdt.internal.corext.fix.CleanUpRefactoring.calculateChange(CleanUpRefactoring.java:775)
	at org.eclipse.jdt.internal.corext.fix.CleanUpPostSaveListener.saved(CleanUpPostSaveListener.java:388)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider$5.run(CompilationUnitDocumentProvider.java:1650)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.notifyPostSaveListeners(CompilationUnitDocumentProvider.java:1644)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.commitWorkingCopy(CompilationUnitDocumentProvider.java:1424)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider$4.execute(CompilationUnitDocumentProvider.java:1503)
	at org.eclipse.ui.editors.text.TextFileDocumentProvider$DocumentProviderOperation.run(TextFileDocumentProvider.java:133)
	at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute(WorkspaceModifyDelegatingOperation.java:71)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.lambda$0(WorkspaceModifyOperation.java:110)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2292)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2317)
	at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.java:131)
	at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:76)
	at org.eclipse.ui.internal.editors.text.WorkspaceOperationRunner.run(WorkspaceOperationRunner.java:66)
	at org.eclipse.ui.editors.text.TextFileDocumentProvider.executeOperation(TextFileDocumentProvider.java:461)
	at org.eclipse.ui.editors.text.TextFileDocumentProvider.saveDocument(TextFileDocumentProvider.java:764)
	at org.eclipse.ui.texteditor.AbstractTextEditor.performSave(AbstractTextEditor.java:5052)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.performSave(CompilationUnitEditor.java:1275)
	at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSave(CompilationUnitEditor.java:1329)
	at org.eclipse.ui.texteditor.AbstractTextEditor$TextEditorSavable.doSave(AbstractTextEditor.java:7182)
	at org.eclipse.ui.Saveable.doSave(Saveable.java:213)
	at org.eclipse.ui.internal.SaveableHelper.doSaveModel(SaveableHelper.java:333)
	at org.eclipse.ui.internal.SaveableHelper.lambda$1(SaveableHelper.java:196)
	at org.eclipse.ui.internal.SaveableHelper.lambda$3(SaveableHelper.java:271)
	at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:436)
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:352)
	at org.eclipse.ui.internal.WorkbenchWindow.lambda$5(WorkbenchWindow.java:2375)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:72)
	at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2373)
	at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:278)
	at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:260)
	at org.eclipse.ui.internal.SaveableHelper.saveModels(SaveableHelper.java:207)
	at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:150)
	at org.eclipse.ui.internal.WorkbenchPage.saveSaveable(WorkbenchPage.java:3820)
	at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3833)
	at org.eclipse.ui.internal.handlers.SaveHandler.execute(SaveHandler.java:57)
	at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
	at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
	at sun.reflect.GeneratedMethodAccessor78.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:58)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:318)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:252)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
	at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
	at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
	at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:308)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:584)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:653)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:443)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$2(KeyBindingDispatcher.java:386)
	at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:96)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
	at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1113)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4382)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1512)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1535)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1549)
	at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1545)
	at org.eclipse.swt.widgets.Canvas.sendKeyEvent(Canvas.java:522)
	at org.eclipse.swt.widgets.Control.doCommandBySelector(Control.java:1081)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:6205)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSResponder.interpretKeyEvents(NSResponder.java:59)
	at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:606)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:6037)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:235)
	at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:2150)
	at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2401)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:6157)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
	at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:5407)
	at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5543)
	at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
	at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:117)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3788)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:658)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	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:657)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1447)
@philwebb
Copy link
Contributor Author

This error only happens when Java 14 support is installed.

@philwebb philwebb changed the title IndexOutOfBoundsException with latest Eclipse update Upgrade to Eclipse 2020.3 with Java 14 Patch Jun 10, 2020
@philwebb philwebb added this to the 0.0.23 milestone Jun 10, 2020
@wilkinsona
Copy link
Contributor

wilkinsona commented Jun 18, 2020

I'm seeing this with 2020.6 and no additional patches. I guess because it ships with Java 14 support out of the box.

@philwebb
Copy link
Contributor Author

Even with the latest snapshot? I guess we need to upgrade again :(

@wilkinsona
Copy link
Contributor

Sorry, I meant to comment on the issue again yesterday and forgot. It works fine with the snapshot.

@marcingrzejszczak
Copy link

I'm using

Spring Tool Suite 4 

Version: 4.12.0.RELEASE
Build Id: 202109130635

and I get a very similar problem

java.lang.IndexOutOfBoundsException: Index 3 out of bounds for length 3
        at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
        at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
        at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:266)
        at java.base/java.util.Objects.checkIndex(Objects.java:359)
        at java.base/java.util.ArrayList.get(ArrayList.java:427)
        at io.spring.javaformat.formatter.eclipse.TokenManager.get(TokenManager.java:76)
        at io.spring.javaformat.formatter.eclipse.TokenManager.findIndex(TokenManager.java:169)
        at io.spring.javaformat.formatter.eclipse.TokenManager.firstIndexIn(TokenManager.java:185)
        at io.spring.javaformat.formatter.eclipse.linewrap.WrapPreparator$FieldAccessAdapter.getIdentifierIndex(WrapPreparator.java:158)
        at io.spring.javaformat.formatter.eclipse.linewrap.WrapPreparator.handleFieldAccess(WrapPreparator.java:628)
        at io.spring.javaformat.formatter.eclipse.linewrap.WrapPreparator.visit(WrapPreparator.java:597)
        at org.eclipse.jdt.core.dom.FieldAccess.accept0(FieldAccess.java:183)
        at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:3056)
        at io.spring.javaformat.formatter.eclipse.DefaultCodeFormatter.prepareWraps(DefaultCodeFormatter.java:435)
        at io.spring.javaformat.formatter.eclipse.ExtendedCodeFormatter.prepareWraps(ExtendedCodeFormatter.java:105)
        at io.spring.javaformat.formatter.eclipse.DefaultCodeFormatter.prepareFormattedCode(DefaultCodeFormatter.java:232)
        at io.spring.javaformat.formatter.eclipse.DefaultCodeFormatter.format(DefaultCodeFormatter.java:186)
        at io.spring.javaformat.formatter.eclipse.DefaultCodeFormatter.format(DefaultCodeFormatter.java:168)
        at io.spring.javaformat.formatter.Formatter.format(Formatter.java:119)
        at io.spring.javaformat.eclipse.formatter.SpringCodeFormatter.format(SpringCodeFormatter.java:44)
        at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.formatString(ASTRewriteFormatter.java:243)
        at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.formatNode(ASTRewriteFormatter.java:379)
        at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteFormatter.getFormattedResult(ASTRewriteFormatter.java:184)
        at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.doTextInsert(ASTRewriteAnalyzer.java:1453)
        at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.rewriteOptionalQualifier(ASTRewriteAnalyzer.java:1026)
        at org.eclipse.jdt.internal.core.dom.rewrite.ASTRewriteAnalyzer.visit(ASTRewriteAnalyzer.java:3294)
        at org.eclipse.jdt.core.dom.MethodInvocation.accept0(MethodInvocation.java:220)

Do you want me to file a new issue about this?

@wilkinsona
Copy link
Contributor

That should have been fixed by #288. Can you give a 0.0.29-SNAPSHOT a try? They're not published to the update site, but you should be able to grab a zip from https://repo.spring.io/ui/native/snapshot/io/spring/javaformat/io.spring.javaformat.eclipse.site/0.0.29-SNAPSHOT and point Eclipse to it as a local archive update site.

@marcingrzejszczak
Copy link

I have updated to the latest 0.0.29-SNAPSHOT version and I get the same issue. Is there a way to disable this plugin?

@wilkinsona
Copy link
Contributor

Ah, we have a CI problem so the latest snapshots are stale. Sorry. It should be fixed in the 0.0.29 snapshots once we've fixed that.

AFAIK, Eclipse doesn't let you disable a plugin. You can just uninstall it though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants