Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355322 - [push down] Enables overloading + super call
Summary: [push down] Enables overloading + super call
Status: CLOSED DUPLICATE of bug 292981
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 13:50 EDT by Gustavo Soares CLA
Modified: 2011-10-24 15:33 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 13:50:41 EDT
Build Identifier:  20110615-0604

Pushing down a method within a method invocation using super changes the name binding of the method invocating to an overloaded method. 

Reproducible: Always

Steps to Reproduce:
1. Create the classes:
public class A {
  public int k(long l) {
    return 10;
  }
}
public class B extends A {
  public int k(int i) {
    return 20;
  }
  public int m() {
    return super.k(2);
  }
}
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(long l) {
    return 10;
  }
}
public class B extends A {
  public int k(int i) {
    return 20;
  }
}
public class C extends B {
  public int m() {
    return super.k(2);
  }
  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 Raksha Vasisht CLA 2011-10-24 15:33:49 EDT

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