Bug 160637 - getKey(...) for BinaryMethod returns a key with '.' in the return type instead of '/'
Summary: getKey(...) for BinaryMethod returns a key with '.' in the return type instea...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.2.2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-12 03:54 EDT by Marc Guenther CLA
Modified: 2007-01-16 02:50 EST (History)
2 users (show)

See Also:


Attachments
Proposed fix (726 bytes, patch)
2006-11-14 11:17 EST, Olivier Thomann CLA
no flags Details | Diff
Regression test (1.64 KB, patch)
2006-11-14 11:18 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Guenther CLA 2006-10-12 03:54:24 EDT
When trying to apply the 'Introduce Indirection' refactoring to a method which is declared in a class from an external library, for example a JDK method, an error panel pops up:
"An unexpected exception occurred during condition checking..."

To reproduce:
- open String.class
- right click on a method declaration in the Outline View, and choose the refactoring.

If I choose an invocation of that method in my src code, everything works fine.

Message from the log:
Internal Error
java.lang.reflect.InvocationTargetException
	at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:350)
	at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:479)
	at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:265)
	at org.eclipse.ui.internal.progress.ProgressManager$3.run(ProgressManager.java:894)
	at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
	at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:929)
	at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:904)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.checkInitialConditions(RefactoringWizardOpenOperation.java:157)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.access$0(RefactoringWizardOpenOperation.java:153)
	at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:123)
	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.startIntroduceIndirectionRefactoring(RefactoringExecutionStarter.java:303)
	at org.eclipse.jdt.ui.actions.IntroduceIndirectionAction.run(IntroduceIndirectionAction.java:154)
	at org.eclipse.jdt.ui.actions.IntroduceIndirectionAction.run(IntroduceIndirectionAction.java:118)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:267)
	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:1496)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1505)
	at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3312)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2941)
	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:324)
	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: java.lang.ClassCastException
	at org.eclipse.jdt.internal.corext.refactoring.code.IntroduceIndirectionRefactoring.checkInitialConditions(IntroduceIndirectionRefactoring.java:431)
	at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:81)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1737)
	at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
Comment 1 Martin Aeschlimann CLA 2006-10-16 07:11:53 EDT
I can't reproduce the problem. But looking at the code there, it looks like a problem in jdt.core

IMethod fTargetMethod= ...;

IBinding[] bindings= parser.createBindings(new IJavaElement[] { fTargetMethod }, null);
fTargetMethodBinding= ((IMethodBinding) bindings[0]).getMethodDeclaration();

Question to jdt.core: Is there any way that the binding for a IMethod is not a IMethodBinding?
Could jdt.core make sure this is always the case an return 'null' otherwise?
Comment 2 Olivier Thomann CLA 2006-11-13 16:17:40 EST
Could not reproduce.
Would it be possible to get reproducable steps based on 3.3M3?

Thanks. Closing as REMIND. Please reopen when steps are available.
Comment 3 Marc Guenther CLA 2006-11-13 16:51:16 EST
Just reproduced this with a fresh install of 3.3M3.

To reproduce:
- fresh install of 3.3M3, new workspace
- create Java Project
- CMD-T (Open Type) the String class
- in the Outline view, right click on substring(int)
- same Error Panel pops up, this time twice: "An unexpected exception occurred during condition checking..."

The Error Log says the following:

eclipse.buildId=I20061102-1715
java.version=1.4.2_09
java.vendor=Apple Computer, Inc.
BootLoader constants: OS=macosx, ARCH=x86, WS=carbon, NL=en_US
Framework arguments:  -keyring /Users/marc/.eclipse_keyring -showlocation
Command-line arguments:  -os macosx -ws carbon -keyring /Users/marc/.eclipse_keyring -consoleLog -showlocation

Error
Mon Nov 13 22:41:19 CET 2006
Internal Error

java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:350)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:479)
at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:265)
at org.eclipse.ui.internal.progress.ProgressManager$3.run(ProgressManager.java:890)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:925)
at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:900)
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.checkInitialConditions(RefactoringWizardOpenOperation.java:157)
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation.access$0(RefactoringWizardOpenOperation.java:153)
at org.eclipse.ltk.ui.refactoring.RefactoringWizardOpenOperation$1.run(RefactoringWizardOpenOperation.java:123)
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.startIntroduceIndirectionRefactoring(RefactoringExecutionStarter.java:365)
at org.eclipse.jdt.ui.actions.IntroduceIndirectionAction.run(IntroduceIndirectionAction.java:154)
at org.eclipse.jdt.ui.actions.IntroduceIndirectionAction.run(IntroduceIndirectionAction.java:118)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:268)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:244)
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:1508)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1532)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1517)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1291)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3369)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2995)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1924)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1888)
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:104)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:74)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:348)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:165)
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:324)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:341)
at org.eclipse.core.launcher.Main.basicRun(Main.java:285)
at org.eclipse.core.launcher.Main.run(Main.java:987)
at org.eclipse.core.launcher.Main.main(Main.java:962)
Caused by: java.lang.ClassCastException
at org.eclipse.jdt.internal.corext.refactoring.code.IntroduceIndirectionRefactoring.checkInitialConditions(IntroduceIndirectionRefactoring.java:428)
at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:81)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1742)
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
at org.eclipse.jdt.internal.corext.refactoring.code.IntroduceIndirectionRefactoring.checkInitialConditions(IntroduceIndirectionRefactoring.java:428)
at org.eclipse.ltk.core.refactoring.CheckConditionsOperation.run(CheckConditionsOperation.java:81)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1742)
at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)
Comment 4 Olivier Thomann CLA 2006-11-13 17:00:29 EST
Reproduced. I am investigating.
Thanks for the test case.
Comment 5 Olivier Thomann CLA 2006-11-14 11:05:49 EST
In order to reproduce, you need to test it on a method with a return type that is not a primitive type. Update title accordingly.
I believe I have a fix for it.
Comment 6 Olivier Thomann CLA 2006-11-14 11:16:59 EST
Philippe,

Might be a good candidate for 3.2.2.
Comment 7 Olivier Thomann CLA 2006-11-14 11:17:21 EST
Created attachment 53822 [details]
Proposed fix
Comment 8 Olivier Thomann CLA 2006-11-14 11:18:03 EST
Added regression test org.eclipse.jdt.core.tests.dom.ASTModelBridgeTests#testCreateBindings19
Comment 9 Olivier Thomann CLA 2006-11-14 11:18:41 EST
Created attachment 53824 [details]
Regression test
Comment 10 Olivier Thomann CLA 2006-11-14 12:37:28 EST
Released for 3.3M4.
Comment 11 Philipe Mulet CLA 2006-11-20 11:27:38 EST
+1 for 3.2.2
Comment 12 Olivier Thomann CLA 2006-11-22 11:33:52 EST
Reopening for 3.2.2.
Comment 13 Olivier Thomann CLA 2006-11-22 15:24:16 EST
Released for 3.2.2.
Same regression test.
Comment 14 Maxime Daniel CLA 2007-01-16 02:50:09 EST
Verified for 3.2.2 using build M20070112-1200.