Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355326 - [pull up] enables overloading + private method
Summary: [pull up] enables overloading + private method
Status: CLOSED DUPLICATE of bug 234980
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6.1   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-21 17:08 EDT by Gustavo Soares CLA
Modified: 2011-10-24 13:42 EDT (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 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 ***