Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 314063 - [extract interface] NPE while 'Extract Interface', 'Use SuperType', 'Extract class' when CU not on Build path
Summary: [extract interface] NPE while 'Extract Interface', 'Use SuperType', 'Extract ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M2   Edit
Assignee: Deepak Azad CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 314227
  Show dependency tree
 
Reported: 2010-05-24 04:12 EDT by Deepak Azad CLA
Modified: 2010-09-14 07:17 EDT (History)
2 users (show)

See Also:


Attachments
fix (3.81 KB, patch)
2010-09-06 08:08 EDT, Deepak Azad CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Deepak Azad CLA 2010-05-24 04:12:44 EDT
Build I20100520-1744

- New workspace
- CVS Repositories view -> Navigate to a Java file stored in a CVS repository -> Right click, select 'Open' from the context menu (I used org.eclipse.jdt.ui.tests.AutomatedSuite)
OR
Open a Java file placed anywhere on the file system (but is not on build path)
- Select a line of code
- From the Menu bar 'Refactor' -> Extract interface => following NPE in error log

java.lang.NullPointerException
at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringActions.convertToEnclosingOrPrimaryType(RefactoringActions.java:53)
at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringActions.getEnclosingOrPrimaryType(RefactoringActions.java:46)
at org.eclipse.jdt.ui.actions.ExtractInterfaceAction.run(ExtractInterfaceAction.java:138)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:278)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:250)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.ui.actions.RetargetAction.runWithEvent(RetargetAction.java:230)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:234)
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:1052)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
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:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:618)
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)
Comment 1 Deepak Azad CLA 2010-05-24 04:20:09 EDT
Same NPE with
- Refactor -> Use SuperType where possible
- Refactor -> Extract class
Comment 2 Deepak Azad CLA 2010-05-24 05:29:39 EDT
This works (for all 3 refactorings) when the java file is stored in a simple project - dialog that 'the CU is not on the build path' shows up.
Comment 3 Deepak Azad CLA 2010-05-25 04:48:17 EDT
Same problem in 3.5.2
Comment 4 Deepak Azad CLA 2010-09-06 08:08:12 EDT
Created attachment 178261 [details]
fix

Fixed in HEAD.
Comment 5 Deepak Azad CLA 2010-09-06 08:08:28 EDT
.
Comment 6 Raksha Vasisht CLA 2010-09-14 07:17:51 EDT
Verified for 3.7 M2 with I20100913-1800.