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

Bug 486693

Summary: [encapsulate field] A behavior preserving transformation (Encapsulate Fiekd Refactoring) is rejected
Product: [Eclipse Project] JDT Reporter: Melina Mongiovi <melmongiovi>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 4.6   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard: stalebug

Description Melina Mongiovi CLA 2016-01-27 20:46:03 EST
Steps to Reproduce:
1. Create the following program

package Package_1;
public class ClassId_1 {
  long getfieldid_0(){
    return 0;
  }
  public long caller_0(){
    return getfieldid_0();
  }
  public long methodid_0(){
    return caller_0();
  }
}
package Package_0;
import Package_1.*;
public class ClassId_0 extends ClassId_1 {
  public long fieldid_0=10;
}


2. Apply the encapsulate refactoring in the field ClassId_0.fieldid_0.

3. The tool does not apply the transformation and warns the following message:


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

package Package_1;
public class ClassId_1 {
  long getfieldid_0(){
    return 0;
  }
  public long caller_0(){
    return getfieldid_0();
  }
  public long methodid_0(){
    return caller_0();
  }
}

package Package_0;
import Package_1.*;
public class ClassId_0 extends ClassId_1 {
  private long fieldid_0=10;

public long getfieldid_0() {
    return fieldid_0;
}

public void setfieldid_0(long fieldid_0) {
    this.fieldid_0 = fieldid_0;
}
}
Comment 1 Eclipse Genie CLA 2020-02-12 18:04:47 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. 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.