Organize imports broken in NB: "AST must not be null"
If I try to organize imports on the following class I get the exception "AST must not be null".
Issue happens on all scala files, not only the one shown below.
Issue appeared in one of the nightly builds of last week (can't recall which one). Still exists in the latest nightly build.
Version: Nightly Build
Scala plugin version: 4.0.0.nightly-2_10-201405060521-df6e7d5
Scala compiler version: 2.10.4.v20140209-180020-b66a39653b
Scala library version: 2.10.4.v20140209-180020-b66a39653b
Eclipse version: 4.2.2.v201302041200
.log file attached. scala-ide.log empty (cleaned before I restarted Eclipse and reproduced the issue).
Issue happens on all scala files, not only the one shown below.
Issue appeared in one of the nightly builds of last week (can't recall which one). Still exists in the latest nightly build.
package com.nezasa.model
class DeadSimpleClass(
val foo: String,
val bar: Int
) {
}
Version: Nightly Build
Scala plugin version: 4.0.0.nightly-2_10-201405060521-df6e7d5
Scala compiler version: 2.10.4.v20140209-180020-b66a39653b
Scala library version: 2.10.4.v20140209-180020-b66a39653b
Eclipse version: 4.2.2.v201302041200
.log file attached. scala-ide.log empty (cleaned before I restarted Eclipse and reproduced the issue).
Leave a comment
on 2014-05-06 12:29 *
By Simon Schäfer
Your log output doesn't show anything specific to the Scala IDE. I think the error is produced by the JDT save action feature. Does the error goes away when you disable the save actions (or at least its organize imports feature)?
Sorry, didn't check the content of the logs. Here is what I get from the event details in the error view:
eclipse.buildId=M20130204-1200
java.version=1.7.0_51
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_US
Framework arguments: -product org.eclipse.epp.package.jee.product -keyring /Users/andreas/.eclipse_keyring -showlocation
Command-line arguments: -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.jee.product -keyring /Users/andreas/.eclipse_keyring -showlocation
Error
Tue May 06 14:49:05 CEST 2014
Internal Error
java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:477)
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:372)
at org.eclipse.ui.internal.WorkbenchWindow$13.run(WorkbenchWindow.java:1679)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:1676)
at org.eclipse.ui.internal.progress.ProgressManager$RunnableWithStatus.run(ProgressManager.java:1346)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.ui.internal.progress.ProgressManager$5.run(ProgressManager.java:1184)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:180)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchronizer.java:150)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4607)
at org.eclipse.ui.internal.progress.ProgressManager.runInUI(ProgressManager.java:1182)
at org.eclipse.jdt.ui.actions.OrganizeImportsAction.run(OrganizeImportsAction.java:291)
at org.eclipse.jdt.ui.actions.OrganizeImportsAction.run(OrganizeImportsAction.java:204)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:279)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:251)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.commands.ActionHandler.execute(ActionHandler.java:119)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:76)
at sun.reflect.GeneratedMethodAccessor37.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:231)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:212)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:131)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:171)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.executeCommand(KeyBindingDispatcher.java:277)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.press(KeyBindingDispatcher.java:496)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.processKeyEvent(KeyBindingDispatcher.java:547)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.filterKeySequenceBindings(KeyBindingDispatcher.java:368)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher.access$0(KeyBindingDispatcher.java:314)
at org.eclipse.e4.ui.bindings.keys.KeyBindingDispatcher$KeyDownFilter.handleEvent(KeyBindingDispatcher.java:83)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.filterEvent(Display.java:1074)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4135)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1458)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1481)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1495)
at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:1491)
at org.eclipse.swt.widgets.Canvas.sendKeyEvent(Canvas.java:497)
at org.eclipse.swt.widgets.Control.doCommandBySelector(Control.java:1060)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5587)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSResponder.interpretKeyEvents(NSResponder.java:68)
at org.eclipse.swt.widgets.Composite.keyDown(Composite.java:587)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5497)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221)
at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:2102)
at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2299)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5559)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:5004)
at org.eclipse.swt.widgets.Display.applicationProc(Display.java:5153)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:128)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3618)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1053)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:942)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:86)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:588)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:543)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:353)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:629)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:584)
at org.eclipse.equinox.launcher.Main.run(Main.java:1438)
Caused by: java.lang.IllegalArgumentException: AST must not be null
at org.eclipse.jdt.core.dom.rewrite.ImportRewrite.create(ImportRewrite.java:191)
at org.eclipse.jdt.ui.CodeStyleConfiguration.createImportRewrite(CodeStyleConfiguration.java:70)
at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility.createImportRewrite(StubUtility.java:1479)
at org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.createTextEdit(OrganizeImportsOperation.java:427)
at org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.run(OrganizeImportsOperation.java:398)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2344)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:5204)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:106)
at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:464)
... 79 more
on 2014-05-06 12:54 *
By Simon Schäfer
I edited my previous post. Can you please check the JDT save action feature?
hey simon,
I disabled the save actions (Project > Properties > Java Editor > Save Actions) first in the project settings. Same issue exists. Then I disabled the project specific settings and disabled save actions on the workspace (Eclipse > Preferences > Java > Editor > Save Actions). I still have the exception.
I disabled the save actions (Project > Properties > Java Editor > Save Actions) first in the project settings. Same issue exists. Then I disabled the project specific settings and disabled save actions on the workspace (Eclipse > Preferences > Java > Editor > Save Actions). I still have the exception.
Note: I switched now to Eclipse Kepler and the latest NB. With this setup I don't have the issue described above.
Following setup works:
Scala plugin version: 4.0.0.nightly-2_10-201405090509-b9b0607
Scala compiler version: 2.10.4.v20140209-180020-b66a39653b
Scala library version: 2.10.4.v20140209-180020-b66a39653b
Eclipse version: 4.3.2.v20140221-1700
Following setup works:
Scala plugin version: 4.0.0.nightly-2_10-201405090509-b9b0607
Scala compiler version: 2.10.4.v20140209-180020-b66a39653b
Scala library version: 2.10.4.v20140209-180020-b66a39653b
Eclipse version: 4.3.2.v20140221-1700
In this case I'm closing this ticket. Feel free to reopen if the problem comes back