Bug 434886

Summary: [move method] A behavior preserving transformation (Move Method Refactoring) is rejected due to conflicts of method names
Product: [Eclipse Project] JDT Reporter: Melina Mongiovi <melmongiovi>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 4.3   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

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.