| Summary: | [refactoring] Pull Up fails with ClassCastException: NullType | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Russell.Morrisey |
| Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | markus.kell.r, Olivier_Thomann |
| Version: | 3.6 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Moving to JDT/UI. Having a reproducable test case is always a plus. So please post your workspace. Thanks. Olivier, Thanks for looking at my posting. I'm not able to post my workspace as is (the example is in my project's proprietary source code, and it runs from a virtual drive managed by clearcase). I tried but was not able to produce an isolated test case. I will spend more time on it tomorrow if you need me to. It's not critical since I can do the refactoring by hand (easily in this case). The root exception is the same as in bug 250914. A test case to reproduce would be nice, but even if you cannot extract an example, please try it with 3.5 or later and add a note in bug 250914 whether you can still reproduce or not. I know it's hard to extract an example here. The problem is that the constraints resolver builds up constraints for all the involved classes, so it is easily possible that the code which causes the problems has no relationship to the methods that are being pulled up (other than living in the same source files). *** This bug has been marked as a duplicate of bug 250914 *** |
Build Identifier: M20080221-1800 In my project's codebase, trying to use Refactor > Pull Up on methods in a certain child class causes Eclipse to display an error. The error happens when I click "Finish" on the first step of the wizard, or in the third step of the wizard when I visit it using "Next" (which I believe should show the modifications to the destination class). I tried to reproduce it in a new workspace, but wasn't able to. I don't think I can post my project's code up on your bugtracker. Some notes about these classes: -Base class is abstract -Base class is parameterized with a generic type -Base class has a static final inner class -Base class does NOT have a method with the same name -Base class implements an interface with a generic type -Base class extends a library class included through the Maven Dependencies (org.apache.wicket.markup.html.form.FormComponent, from wicket 1.4.5). -Child class is parameterized with a generic type, and supplies the same generic type to the base class -Child class has anonymous classes, but not in the method I'm trying to pull up -Error happens when pulling up even a simple, contrived method (public void test() {}). I hoped you might be able to figure it out by looking at the stack trace from the workspace log: !ENTRY org.eclipse.ltk.ui.refactoring 4 10000 2010-01-28 13:32:18.863 !MESSAGE Internal Error !STACK 0 java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:350) at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:934) at org.eclipse.ltk.ui.refactoring.RefactoringWizard.internalPerformFinish(RefactoringWizard.java:553) at org.eclipse.ltk.ui.refactoring.UserInputWizardPage.performFinish(UserInputWizardPage.java:154) at org.eclipse.jdt.internal.ui.refactoring.PullUpMemberPage.performFinish(PullUpMemberPage.java:894) at org.eclipse.ltk.ui.refactoring.RefactoringWizard.performFinish(RefactoringWizard.java:619) at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:742) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog.finishPressed(RefactoringWizardDialog.java:102) at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373) at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:618) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.jface.window.Window.runEventLoop(Window.java:820) at org.eclipse.jface.window.Window.open(Window.java:796) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:142) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:154) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate(RefactoringStarter.java:49) at org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter.startPullUpRefactoring(RefactoringExecutionStarter.java:414) at org.eclipse.jdt.ui.actions.PullUpAction.run(PullUpAction.java:139) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:272) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:244) at org.eclipse.jface.action.Action.runWithEvent(Action.java:498) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353) at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176) 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:585) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447) at org.eclipse.equinox.launcher.Main.run(Main.java:1173) at org.eclipse.equinox.launcher.Main.main(Main.java:1148) Caused by: java.lang.ClassCastException: org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.NullType at org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeSet$SuperTypeSingletonSet.restrictedTo(SuperTypeSet.java:100) at org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeConstraintsSolver.computeTypeEstimates(SuperTypeConstraintsSolver.java:161) at org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeConstraintsSolver.solveConstraints(SuperTypeConstraintsSolver.java:266) at org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeRefactoringProcessor.solveSuperTypeConstraints(SuperTypeRefactoringProcessor.java:1307) at org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor.access$0(PullUpRefactoringProcessor.java:1) at org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor$1.acceptAST(PullUpRefactoringProcessor.java:1876) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:720) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:473) at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:731) at org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor.rewriteTypeOccurrences(PullUpRefactoringProcessor.java:1858) at org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor.createChangeManager(PullUpRefactoringProcessor.java:1209) at org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor.checkFinalConditions(PullUpRefactoringProcessor.java:733) at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:174) at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:83) at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:118) at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:209) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797) at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) Root exception: java.lang.ClassCastException: org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.NullType at org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeSet$SuperTypeSingletonSet.restrictedTo(SuperTypeSet.java:100) at org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeConstraintsSolver.computeTypeEstimates(SuperTypeConstraintsSolver.java:161) at org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeConstraintsSolver.solveConstraints(SuperTypeConstraintsSolver.java:266) at org.eclipse.jdt.internal.corext.refactoring.structure.constraints.SuperTypeRefactoringProcessor.solveSuperTypeConstraints(SuperTypeRefactoringProcessor.java:1307) at org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor.access$0(PullUpRefactoringProcessor.java:1) at org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor$1.acceptAST(PullUpRefactoringProcessor.java:1876) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:720) at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:473) at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:731) at org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor.rewriteTypeOccurrences(PullUpRefactoringProcessor.java:1858) at org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor.createChangeManager(PullUpRefactoringProcessor.java:1209) at org.eclipse.jdt.internal.corext.refactoring.structure.PullUpRefactoringProcessor.checkFinalConditions(PullUpRefactoringProcessor.java:733) at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:174) at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:83) at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:118) at org.eclipse.ltk.core.refactoring.PerformChangeOperation.run(PerformChangeOperation.java:209) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797) at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) HTH Reproducible: Sometimes Steps to Reproduce: 1.Right-click on a method on a child class. 2.Refactor > Pull Up 3.Click Finish.