Bug 356698

Summary: [push down] leads to behavioral change
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: All   
OS: All   
Whiteboard:

Description Gustavo Soares CLA 2011-09-04 19:12:56 EDT
Build Identifier: 20110615-0604

Pushing down a method that contains a super access may change program's behavior by changing the binding of the super access to an overridden method. 

Reproducible: Always

Steps to Reproduce:
Steps to Reproduce:
1. Create the classes:
public class A {
  public int k() {
    return 10;
  }
}
public class B extends A {
  public int k() {
    return 20;
  }
  public int m() {
    return super.k();
  }
}
public class C extends B {
    public static void main(String[] args) {
        C c = new C();
        System.out.println(c.m());
    }
}
2. This program prints 10. Apply a push down method on m():
public class A {
  public int k() {
    return 10;
  }
}
public class B extends A {
  public int k() {
    return 20;
  }
}
public class C extends B {
  public int m() {
    return super.k();
  }
  public static void main(String[] args) {
    C c = new C();
    System.out.println(c.m());

}
3. The behavior of the program changes. Now, the program prints 20.
Comment 1 Markus Keller CLA 2011-09-05 12:23:11 EDT

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