Summary: | Returning the type when local var is selected breaks refactoring | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Dani Megert <daniel_megert> | ||||
Component: | Core | Assignee: | David Audel <david_audel> | ||||
Status: | RESOLVED FIXED | QA Contact: | |||||
Severity: | normal | ||||||
Priority: | P3 | CC: | akiezun | ||||
Version: | 2.0 | ||||||
Target Milestone: | 2.0 M5 | ||||||
Hardware: | PC | ||||||
OS: | Windows NT | ||||||
Whiteboard: | |||||||
Bug Depends on: | |||||||
Bug Blocks: | 12528 | ||||||
Attachments: |
|
Description
Dani Megert
2002-04-02 05:32:47 EST
The fundamental behavior shouldn't have changed. Selecting a local variable has always answered its actual declared type, given there is no such thing as an element for a local variable. Now it also does so for the variable declaration itself (where in the past it used to be doing nothing or misbehave in trying to lookup a type named like the variable). Can you provide a concrete test case ? It does not happend for all local variables (but if it happens it does so in both cases i.e. on the declaration and where used). Test Case: - ensure to have the newest code of org.eclipse.search.internal.ui.CopyToClipboardAction.java from ZRH repository (I changed it today and that's where I saw the problem) NOTE: I have attached the corresponding CU - select "labelProvider" in run() - Refactor -> Rename Looking at Search which in all cases uses/gets the type it rather loooks like a JDT UI refactoring bug. BUT I think it is wrong to return the type if I do code resolve on a local variable name. It might be handy for F3/F4 but definitely isn't for search. IMO code resolve should not be smart (or should have two modes like strict and smart). It is not clear/logic to me that F3 on a field goes to the field while F3 on a local var is smart and goes to the declaring type (though this is rather UI related than a code resovle problem). Created attachment 534 [details]
CopyToClipboardAction.java
Selecting a local variable has always answered its type (except for declaration which answered nothing). How did it work before to rename local variable ? weird - it must've returned null before because what my rename action does is: try resolving - if succesful then rename the resolved symbol if not succesful (null returned) - try, maybe it's a local variable i will experiment with the opposite approach - i.e. try local vars first, use code resolve as a fallback and will let you know it worked ok to close this report, i think closed. |