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

Bug 355326

Summary: [pull up] enables overloading + private method
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: raksha.vasisht
Version: 3.6.1   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard:

Description Gustavo Soares CLA 2011-08-21 17:08:04 EDT
Build Identifier: 20110615-0604

Pulling up a method enables overloading of a private method changing program behavior

Reproducible: Always

Steps to Reproduce:
1. Create the classes:
public class A {
  public int k(long l) {
    return 1; 
  }
  private int k(int l) {
    return 2; 
  }
}
public class B extends A {    
  public int m() {
    return k(2);
  }   
  public int test() {
    return m();
  }
}
2. The test method returns 1. Apply the Pull up refactoring to m(). 
public class A {
  public int k(long l) {
    return 1; 
  }
  private int k(int l) {
    return 2; 
  }
  public int m() {
    return k(2);
  }   
}
public class B extends A {    
  public int test() {
    return m();
  }
}
3. After the transformation, the test method returns 2 instead of 1.
Comment 1 Raksha Vasisht CLA 2011-10-24 11:47:06 EDT
Also see Bug 316831.
Comment 2 Raksha Vasisht CLA 2011-10-24 13:42:34 EDT

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