Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 430977

Summary: [refactoring] Rename / Change method signature doesn't change all sources
Product: [Eclipse Project] JDT Reporter: Marco Hofstetter <mr.tacker>
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, manoj.palat, markus.kell.r, mr.tacker, srikanth_sankaran
Version: 4.3.2   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard: stalebug
Attachments:
Description Flags
Demo Projects none

Description Marco Hofstetter CLA 2014-03-24 04:53:24 EDT
Created attachment 241157 [details]
Demo Projects

Changing the signature ("rename" or "change method signature") of the interface "BaseInterface2" in the attached projects doesn't change the source of all implementations in the interface-typehierarchy.

The problem occurs in the attached demo-setup with the following diamond-project-structure.

          TOP
         /   \
        /     \
       A       B
        \     /
         \   /
         BASE

The problem seems to lay in the RegionBasedTypeHierarchy / TypeHierarchy which will be built during the refactoring. Assigning the javaproject of the first element as the context-project of the TypeHierarchy seems to be problematically (In the constructor of RegionBasedTypeHierarchy). Changing the member "project" of the "RegionBasedTypeHierarchy" to the project "top" during debugging refactors all occurances.
Comment 1 Srikanth Sankaran CLA 2014-03-25 00:11:37 EDT
Manoj, please take a look.
Comment 2 Manoj N Palat CLA 2014-03-26 05:10:33 EDT
Not able to reproduce this issue. All the references get changed when Refactor->rename (Alt-Shift-R) used. [change method signature does not apply to the interface (BaseInterface2)  - did you mean something else here?] Let me know if there are any further steps required to reproduce the issue
Comment 3 Marco Hofstetter CLA 2014-03-26 05:34:28 EDT
Sorry, i forgot to mention that the error occurs when i apply the refactoring to the method "setTest" in the interface "BaseInterface2".

Changing the name of the method or add a new parameter.
Comment 4 Manoj N Palat CLA 2014-04-05 05:10:54 EDT
Jay: could you verify the Java Model part?
Comment 5 Markus Keller CLA 2014-05-06 08:15:03 EDT
I think the first call to a jdt.core API that returns a wrong value can be seen when you add a conditional breakpoint to org.eclipse.jdt.internal.corext.refactoring.rename.RippleMethodFinder2#uniteWithSupertypes(..) with condition:

    "B_Class".equals(type.getElementName())

The call to fHierarchy.getSupertypes(type) only returns Object, but misses B_Interface.
Comment 6 Jay Arthanareeswaran CLA 2014-05-08 14:55:54 EDT
I can reproduce this. The issue seems to be this: When we are building the package fragment cache for project 'base', one of the depending projects is left out, usually as per the alphabetic order. You can verify this by renaming project 'a' to 'c'. We are keeping the depending project and constructing the cache through DeltaProcessor#RootInfo#project, which unfortunately supports only one project and the last one to the party is left out. It remains to be seen what we can do in Luna time frame. I will investigate.
Comment 7 Jay Arthanareeswaran CLA 2014-05-09 00:47:52 EDT
(In reply to Jayaprakash Arthanareeswaran from comment #6)
> I can reproduce this. The issue seems to be this: When we are building the
> package fragment cache for project 'base', one of the depending projects is
> left out, usually as per the alphabetic order. You can verify this by
> renaming project 'a' to 'c'. We are keeping the depending project and
> constructing the cache through DeltaProcessor#RootInfo#project, which
> unfortunately supports only one project and the last one to the party is
> left out.


Looks like it's been this way for quite some time. I can reproduce this behavior as far back as 3.7. It might be too risky to touch the delta processor at this time. Will see if I can come up with a workaround.
Comment 8 Markus Keller CLA 2014-05-09 08:37:27 EDT
(In reply to Jayaprakash Arthanareeswaran from comment #7)
> I can reproduce this behavior as far back as 3.7.

Then it's totally fine to move it out of 4.4.
Comment 9 Jay Arthanareeswaran CLA 2014-05-11 12:33:01 EDT
I gave a quick try, but looks like it won't be a safe fix at this stage. Will revisit early in 4.5.
Comment 10 Jay Arthanareeswaran CLA 2015-05-12 04:01:25 EDT
No progress on this. Moving out to 4.6.
Comment 11 Jay Arthanareeswaran CLA 2016-04-05 04:32:54 EDT
No progress yet and unlikely to get time during 4.6. Moving out.
Comment 12 Manoj N Palat CLA 2018-05-21 06:06:53 EDT
Bulk move out of 4.8
Comment 13 Eclipse Genie CLA 2020-05-11 17:10:27 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.