Bug 356684 - [push down] changes behavior due to declaration shadowing
Summary: [push down] changes behavior due to declaration shadowing
Status: CLOSED DUPLICATE of bug 211755
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.8   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-04 15:24 EDT by Gustavo Soares CLA
Modified: 2011-09-05 12:21 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-09-04 15:24:52 EDT
Build Identifier: 20110615-0604

Pushing down a method to a class in another package may shadow a Class declaration leading to a behavioral change 

Reproducible: Always

Steps to Reproduce:
1. Create the classes
package p2;
public class B extends A {
}
package p1;
import p2.*;
public class B extends A {
  protected long k(  int a){
    return 0;
  }
  public long test(){
    return m();
  }
}
package p2;
import p1.*;
public class A {
  public long k(  long a){
    return 1;
  }
  public long m(){
    return new B().k(2);
  }
}
2. Apply the push down method to m()
package p1;
import p2.*;
public class B extends A {
  protected long k(  int a){
    return 0;
  }
  public long test(){
    return m();
  }
public long m() {
    return new B().k(2);
  }
}
package p2;
public class B extends A {
	public long m() {
	    return new B().k(2);
	  }
}
package p2;
import p1.*;
public class A {
  public long k(  long a){
    return 1;
  }
}
3. Before the transformation, method m() yields 1, but after that, it yields 0.
Comment 1 Markus Keller CLA 2011-09-05 12:21:30 EDT

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