Bug 355324 - [push down method] enables overloading + private method
Summary: [push down method] enables overloading + private method
Status: CLOSED DUPLICATE of bug 211755
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 15:54 EDT by Gustavo Soares CLA
Modified: 2011-10-24 13:03 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 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 ***