Bug 434886 - [move method] A behavior preserving transformation (Move Method Refactoring) is rejected due to conflicts of method names
Summary: [move method] A behavior preserving transformation (Move Method Refactoring) ...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-14 13:29 EDT by Melina Mongiovi CLA
Modified: 2023-05-04 20:14 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Melina Mongiovi CLA 2014-05-14 13:29:06 EDT
Behavior Preserving Transformation is rejected.



Reproducible: Always

Steps to Reproduce:
1. Create the classes

package p1;
import p0.*;
public class A {
  public long test(){
    return new C().m(2);
  }
}

package p1;
import p0.*;
public class B extends A{
  public C f = null;
  private long m(int a) {
    return 0;
  }
}

package p0;
import p1.*;
public class C extends B {
  public long m(int a) {
    return 1;
  }
}

2. Apply the move method refactoring to move method m(int) from class B to class C.

3. The tool does not apply the transformation and warn the following message:
A method with * name already exists in the target type

4. Another refactoring tool applies the same transformation and the resulting program (the program below) preserves the program behavior.

package p1;
import p0.*;
public class A {
  public long test(){
    return new C().m(2);
  }
}

package p1;
import p0.*;
public class B extends A{
  public C f = null;
}

package p0;
import p1.*;
public class C extends B {
  public long m(int a) {
    return 1;
  }
  private long m(B b, int a) {
    return 0;
  }
}
Comment 1 Martin Mathew CLA 2014-05-15 00:23:08 EDT
*** Bug 434881 has been marked as a duplicate of this bug. ***
Comment 2 Dani Megert CLA 2014-05-15 04:48:38 EDT
(In reply to Melina Mongiovi from comment #0)
> 4. Another refactoring tool applies the same transformation and the
> resulting program (the program below) preserves the program behavior.

>   private long m(B b, int a) {
>     return 0;
>   }
> }

FYI: Moving the private method and leave it private would be useless.
Comment 3 Eclipse Genie CLA 2019-05-02 08:39:20 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.

If you have further information on the current state of the bug, please add it. 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.
Comment 4 Eclipse Genie CLA 2021-04-22 11:58:48 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.

If you have further information on the current state of the bug, please add it. 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.
Comment 5 Eclipse Genie CLA 2023-05-04 20:14:20 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.

If you have further information on the current state of the bug, please add it. 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.