Bug 486694 - [move method] A behavior preserving transformation (Move Method Refactoring) is rejected
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.6   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-27 20:52 EST by Melina Mongiovi CLA
Modified: 2023-03-03 14:02 EST (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 2016-01-27 20:52:50 EST
Steps to Reproduce:
1. Create the following program


package Package_1;
public class ClassId_1 {
  protected long m_0(  int a){
    return 1;
  }
}

package Package_0;
import Package_1.*;
public class A_0 extends ClassId_1 {
  public ClassId_0 fieldid_0= new ClassId_0();
  protected long m_0(  int a){
    return 0;
  }
}

package Package_0;
public class ClassId_0 extends A_0 {
  public long methodid_0(){
    return this.m_0(2);
  }
}

2. Apply the move method refactoring to move method m_0(int) from class A_0 to class ClassId_0.

3. The tool does not apply the transformation and warn the following message:
The method invocations to m_0 cannot be updated since the original method is used  Polymorphically.

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

package Package_1;
public class ClassId_1 {
  protected long m_0(  int a){
    return 1;
  }
}
package Package_0;
import Package_1.*;
public class A_0 extends ClassId_1 {
  public ClassId_0 fieldid_0=new ClassId_0();
  protected long m_0(  int a){
    return fieldid_0.m_0(a);
}
}

package Package_0;
public class ClassId_0 extends A_0 {
  public long methodid_0(){
    return this.m_0(2);
  }

protected long m_0(  int a){
    return 0;
  }
}
Comment 1 Eclipse Genie CLA 2019-02-26 12:01:50 EST
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 2 Eclipse Genie CLA 2021-02-17 14:19:10 EST
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 3 Eclipse Genie CLA 2023-03-03 14:02:17 EST
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.