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

Bug 356697

Summary: [change method signature] adding parameter enables overloading and changes program behavior
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: markus.kell.r
Version: 3.8   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Gustavo Soares CLA 2011-09-04 19:07:59 EDT
Build Identifier: 20110615-0604

Adding a parameter using the change method signature refactoring may enable an overloading and changes program behavior.

Reproducible: Always

Steps to Reproduce:
1. Create the classes
public class A {
  public long k() {
    return 1;
  }
  public long k(long a) {
    return 2;
  }
  public long test() {
    return new A().k(2);
  }
}
2. Apply the Change Method Signature to add a Int parameter to k()
public class A {
  public long k(int a) {
    return 1;
  }
  public long k(long a) {
    return 2;
  }
  public long test() {
    return new A().k(2);
  }
}
3. The transformation changes behavior. After the refactoring, the test method returns 1 instead of 2.
Comment 1 Markus Keller CLA 2011-09-05 12:52:18 EDT

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