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

Bug 316828

Summary: [push down] pushing down a method enables field hiding
Product: [Eclipse Project] JDT Reporter: Gustavo Soares <gsoares>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: deepakazad
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Gustavo Soares CLA 2010-06-14 16:55:22 EDT
Build Identifier: 20090920-1017

Apply the push down method refactoring to a method leads to a behavioral change due to field hiding.

Reproducible: Always

Steps to Reproduce:
1. Create the classes:

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

2. the method test returns 10.
2. Apply the push down refactoring to m():

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


3. After the refactoring, the method test returns 20.
Comment 1 Deepak Azad CLA 2010-06-15 15:56:14 EDT

*** This bug has been marked as a duplicate of bug 211755 ***