Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 399788

Summary: [Pull Up Method] Strong precondition: Method [] referenced in one of the moved elements is not accessible from type []
Product: [Eclipse Project] JDT Reporter: Gustavo Soares <gsoares>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: noopur_gupta
Version: 4.2   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard: stalebug

Description Gustavo Soares CLA 2013-02-02 18:08:22 EST
Step 1: Create the classes:

package p1;
public class A {
  protected long k(  long a){
    return 6;
  }
}

package p2;
import p1.*;
public class B extends A {
  public long m(){
    return new B().k(2);
  }
  public long k(  int a){
    return 92;
  }
  public long test(){
    return m();
  }
}


Step 2: apply the pull up method to the m() method. Eclipse will show a warning:  Method p2.B.k(...) referenced in one of the moved elements is not accessible from type p1.A. However, if we apply the transformation regardless the warning, the resulting program will compile:

package p1;

import p2.B;

public class A {
  protected long k(  long a){
    return 6;
  }

public long m() {
    return new B().k(2);
  }
}

package p2;
import p1.*;
public class B extends A {
  public long k(  int a){
    return 92;
  }
  public long test(){
    return m();
  }
}
Comment 1 Noopur Gupta CLA 2013-02-05 07:02:06 EST
Tested with Build ID: I20130204-1400.
The bug is reproducible.
Comment 2 Eclipse Genie CLA 2019-10-14 00:25:30 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.