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

Bug 355324

Summary: [push down method] 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 15:54:56 EDT
Build Identifier: 20110615-0604

Pushing down a method enables overloading of a private method changing program behavior

Reproducible: Always

Steps to Reproduce:
1. Create the classes:
package p1;
import p2.*;
public class A {
  public long m(){
    return new B().methodid_1(2);
  }
  public static void main(String[] args) {
		System.out.println(new B().methodid_0());
	}
}
package p2;
import p1.*;
public class B extends A {
  private long methodid_1(  int a){
    return 1;
  }
  public long methodid_1(  long a){
    return 0;
  }
  public long methodid_0(){
    return m();
  }
}
2. This program prints 0. Apply a push down method on m():

package p1;
import p2.*;
public class A {
  public static void main(String[] args) {
		System.out.println(new B().methodid_0());
	}
}
package p2;
import p1.*;
public class B extends A {
  public long m(){
    return new B().methodid_1(2);
  }
  private long methodid_1(  int a){
    return 1;
  }
  public long methodid_1(  long a){
    return 0;
  }
  public long methodid_0(){
    return m();
  }
}
3. The behavior of the program changes. Now, the program prints 1.
Comment 1 Raksha Vasisht CLA 2011-10-24 13:03:48 EDT

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