Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 558948 - Rename Class leaves references in both code and PHPDoc untouched
Summary: Rename Class leaves references in both code and PHPDoc untouched
Status: NEW
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 8
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-01-08 18:20 EST by Nobody - feel free to take it CLA
Modified: 2020-05-14 10:16 EDT (History)
1 user (show)

See Also:


Attachments
Screenshot of outdated references and search results (116.12 KB, image/png)
2020-01-08 18:20 EST, Nobody - feel free to take it CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nobody - feel free to take it CLA 2020-01-08 18:20:10 EST
Created attachment 281419 [details]
Screenshot of outdated references and search results

I just used Refactor->Rename... on a class for the first time, and while it let me change the class's name, no magic followed. Ignoring the file name issue (already tracked in ticket #467760), the 7 existing references were left unchanged. Most of these are just in PHPDoc tags, but one is an instanciation which - as can be seen in the attached screenshot - is now understandably broken (and correctly detected as erroneous). The class's new name is "NaadAdnaInfo". It was "NaadAdnaEntry" before.

This project's code is private, but I could create a test case if this is difficult to reproduce.

This affects PDT 7.0.0 running on Windows 8.
Comment 1 Nobody - feel free to take it CLA 2020-01-08 18:28:10 EST
Hum, on closer look, it looks like this is not a "defect" but a design bug. If I click the arrow at the right of the "Enter new name, press Enter to refactor" tooltip which appears, I can ask to update references, and that seems to work.

I would expect such an update to be done by default, or at least, to be warned if it is not.
Comment 2 Dawid Pakula CLA 2020-01-08 18:35:41 EST
In same way it working with java. Ctr shift r, by default run simple inline edit generated based on occurence finder, if press esc, only visible changes will be commited to buffer (very usable on simple field renames), but if you click enter magic will begin. PDT and other plugins will calculate potential changes.

I’m afraid you might be affected by CA. You saw assist popup and just press esc.
Comment 3 Nobody - feel free to take it CLA 2020-01-09 10:00:26 EST
Thanks Dawid,

(In reply to Dawid Pakula from comment #2)
> In same way it working with java. Ctr shift r, by default run simple inline
> edit generated based on occurence finder, if press esc, only visible changes
> will be commited to buffer (very usable on simple field renames), but if you
> click enter magic will begin. PDT and other plugins will calculate potential
> changes.

I do not think I understand your comment. Are you speaking about "Open Resource"?


> I’m afraid you might be affected by CA. You saw assist popup and just press
> esc.

I did not press the Escape key. I pressed the Enter key.
Comment 4 Dawid Pakula CLA 2020-01-09 10:54:18 EST
(In reply to Filipus Klutiero from comment #3)
> I do not think I understand your comment. Are you speaking about "Open
> Resource"?
No, about another refactoring mode (simple in-place). you din't use it :P
> 
> > I’m afraid you might be affected by CA. You saw assist popup and just press
> > esc.
> 
> I did not press the Escape key. I pressed the Enter key.

OK I made couple tests:
1. "Update textual occurrences in comments and strings" is disabled by default as in JDT and its ok but
2. "Update textual occurrences in comments and strings" is not saved after first use
3. "Update textual occurrences in comments and strings" is required to correctly update @see, @param, @var and other PHPDoc and this is also wrong!

First issue (point 2) should be simple to fix but second it's a little bigger task. For example see bug 536759.

In short another PDT nightmare: PHPDoc support and relation to rest features
1. Declaration AST node haven't real reference to it's comment. Compiler AST have IPHPDocAwareDeclaration, but it's ignored during traverse, DOM AST haven't such relation completely 
2. IMember (IType, IMethod, IField) havent reference to PHPDoc like in JDT/JSDT to source 
3. IMember ISourceReference never cover it's documentation (mentioned bug 536759)
4. 

Due this:
1. TI (TypeInference) aften scan all comments backwards
2. OccurenceFinder ignore PHPDoc
3. Hover on PHPDoc (@return, @return ...) ignore namespace


We again can prepare ton of workarounds/baypasses/adapters/proxies but sooner/later we have to switch to own model (for example handle bug 531023) and/or make DLTK really extandable ;)
Comment 5 Nobody - feel free to take it CLA 2020-01-09 11:12:22 EST
(In reply to Dawid Pakula from comment #4)
> (In reply to Filipus Klutiero from comment #3)
> > I do not think I understand your comment. Are you speaking about "Open
> > Resource"?
> No, about another refactoring mode (simple in-place). you din't use it :P

I'm afraid I do not know that mode. Pressing the R key while holding Ctrl and Shift brings up an "Open Resource" dialog on my Eclipse install.
Comment 6 Dawid Pakula CLA 2020-01-09 11:17:46 EST
(In reply to Filipus Klutiero from comment #5)
> (In reply to Dawid Pakula from comment #4)
> > (In reply to Filipus Klutiero from comment #3)
> > > I do not think I understand your comment. Are you speaking about "Open
> > > Resource"?
> > No, about another refactoring mode (simple in-place). you din't use it :P
> 
> I'm afraid I do not know that mode. Pressing the R key while holding Ctrl
> and Shift brings up an "Open Resource" dialog on my Eclipse install.

Arghh I mean simple cmd/ctrl+alt+r and after modify simple click "esc" rather than enter.

If you double click cmd/ctrl+alt+r you will see rename dialog without touch arrow.
Comment 7 Nobody - feel free to take it CLA 2020-01-09 11:30:58 EST
(In reply to Dawid Pakula from comment #6)
> (In reply to Filipus Klutiero from comment #5)
> > (In reply to Dawid Pakula from comment #4)
> > > (In reply to Filipus Klutiero from comment #3)
> > > > I do not think I understand your comment. Are you speaking about "Open
> > > > Resource"?
> > > No, about another refactoring mode (simple in-place). you din't use it :P
> > 
> > I'm afraid I do not know that mode. Pressing the R key while holding Ctrl
> > and Shift brings up an "Open Resource" dialog on my Eclipse install.
> 
> Arghh I mean simple cmd/ctrl+alt+r and after modify simple click "esc"
> rather than enter.

I use Eclipse on Windows. Pressing the R key while holding Ctrl and Alt, changing the name then pressing Escape does no visible magic.


> If you double click cmd/ctrl+alt+r you will see rename dialog without touch
> arrow.

I do not understand what you mean by "double click cmd/ctrl+alt+r".