Bug 313045

Summary: [pull up] Pulling up two fields leads to behavioral change due to a change of the value of one of the fields
Product: [Eclipse Project] JDT Reporter: Gustavo Soares <gsoares>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: daniel_megert, deepakazad
Version: 3.6   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description Gustavo Soares CLA 2010-05-16 15:38:30 EDT
Build Identifier: 20090920-1017

Apply the pull up field refactoring to a field f moves all fields f of the subclasses to the super class. If one of the fields is initialized with different value, the behavior of the program may change

Reproducible: Always

Steps to Reproduce:
1. Create the classes:

public class A {
}
public class B extends A {
  public int k = 10; 
}
public class C extends A {
  public int k = 20;
  public long test() {
    return k;
  }    
}

2. The method test returns 20 
3. Apply the pull up field refactoring to B.f

public class A {
  public int k = 10;
}
public class B extends A {   
}
public class C extends A {  
  public long test() {
    return k;
  }    
}

4. The method test returns 10 instead of 20. The refactoring changes the program behavior
Comment 1 Dani Megert CLA 2010-05-19 10:41:31 EDT
Similar to bug 313043 but the other way around.
Comment 2 Dani Megert CLA 2010-05-19 11:01:41 EDT
Not a regression.
Comment 3 Eclipse Genie CLA 2020-05-06 12:18:31 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.