Bug 434862

Summary: [push down] Pushing down a field causes compilation error
Product: [Eclipse Project] JDT Reporter: Melina Mongiovi <melmongiovi>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 4.3   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Melina Mongiovi CLA 2014-05-14 10:47:15 EDT
Pushing down a field may cause compilation error.

Reproducible: Always

Steps to Reproduce:
1. Create classes:

package p1;
public class A {
  protected int f = 11;
}

package p0;
import p1.*;
public class B extends A{
  protected int f = 10;
}

package p0;
public class C extends B {
  public long m() {
    return new B().f;
  }
}

2. Apply the push down field refactoring (push down the field f from B to C)

package p1;
public class A {
  protected int f = 11;
}

package p0;
import p1.*;
public class B extends A{
}

package p0;
public class C extends B {
  protected int f = 10;
  public long m() {
    return new B().f;
  }
}

3. After the refactoring, resulting program does not compile.
Comment 1 Melina Mongiovi CLA 2014-05-14 10:48:19 EDT
Pushing down a field may cause compilation error.

Reproducible: Always

Steps to Reproduce:
1. Create classes:

package p1;
public class A {
  protected int f = 11;
}

package p0;
import p1.*;
public class B extends A{
  protected int f = 10;
}

package p0;
public class C extends B {
  public long m() {
    return new B().f;
  }
}

2. Apply the push down field refactoring (push down the field f from B to C)

package p1;
public class A {
  protected int f = 11;
}

package p0;
import p1.*;
public class B extends A{
}

package p0;
public class C extends B {
  protected int f = 10;
  public long m() {
    return new B().f;
  }
}

3. After the refactoring, resulting program does not compile.
Comment 2 Dani Megert CLA 2014-05-14 11:32:51 EDT

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