| Summary: | [refactoring] [plan] NPE when performing pull out refactoring | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Tools] AJDT | Reporter: | Andrew Eisenberg <andrew.eisenberg> | ||||
| Component: | Core | Assignee: | AJDT-inbox <AJDT-inbox> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | minor | ||||||
| Priority: | P3 | ||||||
| Version: | 2.1.0 | ||||||
| Target Milestone: | 2.1.1 | ||||||
| Hardware: | Macintosh | ||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Another stack trace, happening when I select exactly the 3 fields and go through the steps to pull out: java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:330) at org.eclipse.ltk.ui.refactoring.RefactoringWizard.internalPerformFinish(RefactoringWizard.java:573) at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.performFinish(UserInputWizardPage.java:153) at org.eclipse.ltk.ui.refactoring.RefactoringWizard.performFinish(RefactoringWizard.java:646) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.okPressed(RefactoringWizardDialog2.java:454) at org.eclipse.jface.dialogs.Dialog.buttonPressed(Dialog.java:472) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:234) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1660) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1684) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1669) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1412) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3644) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3227) at org.eclipse.jface.window.Window.runEventLoop(Window.java:825) at org.eclipse.jface.window.Window.open(Window.java:801) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:180) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:192) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:115) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoringAction.run(PullOutRefactoringAction.java:118) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoringAction.run(PullOutRefactoringAction.java:112) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1660) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1684) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1669) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1412) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3644) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3227) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) 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:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) 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:592) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574) at org.eclipse.equinox.launcher.Main.run(Main.java:1407) at org.eclipse.equinox.launcher.Main.main(Main.java:1383) Caused by: org.eclipse.core.runtime.AssertionFailedException: assertion failed: at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110) at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring.getInsertLocation(PullOutRefactoring.java:863) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring.access$2(PullOutRefactoring.java:861) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring$AspectRewrite.rewriteAspect(PullOutRefactoring.java:148) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring$AspectRewrite.access$0(PullOutRefactoring.java:120) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring.createChange(PullOutRefactoring.java:837) at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:124) at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:209) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975) at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) Root exception: org.eclipse.core.runtime.AssertionFailedException: assertion failed: at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110) at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring.getInsertLocation(PullOutRefactoring.java:863) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring.access$2(PullOutRefactoring.java:861) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring$AspectRewrite.rewriteAspect(PullOutRefactoring.java:148) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring$AspectRewrite.access$0(PullOutRefactoring.java:120) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring.createChange(PullOutRefactoring.java:837) at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:124) at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:209) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975) at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) The second exception trace, I think should be fixed after applying patch from 316809 This was the assert that checks whether an aspect's "getSource" ends with a "}". This check was only a safety check to see whether I got what I expected, before attempting to insert ITDs before that brace. While the check now fails, it looks like this is expected, and the source location is for the generated edits is still correct despite the assert failing there. So I have removed that assert. The first stack trace is an unrelated issue, I'll look into that. Created attachment 175119 [details]
Patch with a fix
Patch is applied and committed. Need to update push-in refactoring to use this. |
I got an NPE when doing the following. Here is the class: public class Clazz { int x; int y; int z; } In an editor, select all 3 fields (the entire lines and including the whitespace after) and perform Pull-out refactoring from the context menu. I get the following stack Trace (selecting less and the exception will not occur): java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:421) at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:507) at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:275) at org.eclipse.ui.internal.progress.ProgressManager$5.run(ProgressManager.java:960) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:995) at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:970) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.checkInitialConditions(RefactoringWizardOpenOperation.java:205) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.access$0(RefactoringWizardOpenOperation.java:200) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:163) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:192) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:115) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoringAction.run(PullOutRefactoringAction.java:118) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoringAction.run(PullOutRefactoringAction.java:112) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1660) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1684) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1669) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1412) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3644) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3227) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427) at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115) 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:369) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) 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:592) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574) at org.eclipse.equinox.launcher.Main.run(Main.java:1407) at org.eclipse.equinox.launcher.Main.main(Main.java:1383) Caused by: org.eclipse.core.runtime.AssertionFailedException: assertion failed: at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110) at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring.isInTopLevelType(PullOutRefactoring.java:910) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring.checkInitialConditions(PullOutRefactoring.java:705) at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:83) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975) at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121) Root exception: org.eclipse.core.runtime.AssertionFailedException: assertion failed: at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110) at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring.isInTopLevelType(PullOutRefactoring.java:910) at org.eclipse.ajdt.internal.ui.refactoring.pullout.PullOutRefactoring.checkInitialConditions(PullOutRefactoring.java:705) at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:83) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1975) at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)