Project: JDT
Bug 169932 [generalize type] InvocationTargetException on array declaration
Reported: 2007-01-09 02:19:45 | Status: resolved fixed

Build ID: M20060921-0945 Steps To Reproduce: If the generalize declared type refactoring is run on an array declaration like the one of the parameter args: public static void main(String args[]) {...} the refactoring throws an AssertionFailedException. More information: !ENTRY org.eclipse.jdt.ui 4 10001 2007-01-09 08:08:31.218 !MESSAGE Internal Error !STACK 0 java.lang.reflect.InvocationTargetException at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:350) at org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.run(RefactoringWizardDialog2.java:304) at org.eclipse.jdt.internal.ui.refactoring.ChangeTypeWizard$ChangeTypeInputPage$ValidTypesTask.run(ChangeTypeWizard.java:207) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971) 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:132) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67) at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.run(RefactoringWizardOpenOperation.java:145) at org.eclipse.jdt.internal.ui.refactoring.actions.RefactoringStarter.activate(RefactoringStarter.java:40) at org.eclipse.jdt.internal.corext.refactoring.RefactoringExecutionStarter.startChangeTypeRefactoring(RefactoringExecutionStarter.java:212) at org.eclipse.jdt.ui.actions.ChangeTypeAction.run(ChangeTypeAction.java:156) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:271) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:243) at org.eclipse.jface.action.Action.runWithEvent(Action.java:499) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:95) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177) 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.core.launcher.Main.invokeFramework(Main.java:336) at org.eclipse.core.launcher.Main.basicRun(Main.java:280) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952) Caused by: org.eclipse.core.runtime.AssertionFailedException: assertion failed: No constraint variable matches the selected ASTNode. at org.eclipse.core.runtime.Assert.isTrue(Assert.java:109) at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeTypeRefactoring.findConstraintVariableForSelectedNode(ChangeTypeRefactoring.java:937) at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeTypeRefactoring.computeValidTypes(ChangeTypeRefactoring.java:418) at org.eclipse.jdt.internal.ui.refactoring.ChangeTypeWizard$1.run(ChangeTypeWizard.java:198) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113) Root exception: org.eclipse.core.runtime.AssertionFailedException: assertion failed: No constraint variable matches the selected ASTNode. at org.eclipse.core.runtime.Assert.isTrue(Assert.java:109) at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeTypeRefactoring.findConstraintVariableForSelectedNode(ChangeTypeRefactoring.java:937) at org.eclipse.jdt.internal.corext.refactoring.structure.ChangeTypeRefactoring.computeValidTypes(ChangeTypeRefactoring.java:418) at org.eclipse.jdt.internal.ui.refactoring.ChangeTypeWizard$1.run(ChangeTypeWizard.java:198) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)

Files changed in fix:
org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testArray2_in.java org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testArray_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testBogusSelection_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testEnum_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testFieldOfLocalType_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testInvalidSelection_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testMultiDeclaration_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testObjectReturnType_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testOverriddenBinaryMethod_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testPrimitive_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testQualifiedFieldRef_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testTypeParameter_out.java org.eclipse.jdt.ui.tests.refactoring/resources/ChangeTypeRefactoring/negative/A_testUpdateNotPossible_out.java org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/ChangeTypeRefactoringTests.java org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/structure/ChangeTypeRefactoring.java