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

Bug 399350

Summary: [Pull Up Method] Strong precondition: The visibility of method will be changed to public
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.3   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X   
Whiteboard: stalebug

Description Gustavo Soares CLA 2013-01-28 21:35:06 EST
Step 1: Create the classes:

package p1;
public class A{
  protected long k(){ return 85; }
}
package p2;
import p1.*;
public class B extends A{
  public long m (){
    return k();
  }
  protected long k(){return 77;}
}

Step 2: apply the pull up method to the method m(). Eclipse will show a warning:  The visibility of method 'p2.B.k()' will be changed to public. However we can apply these transformation even without changing the visibility of the method B.k. The following program compiles:

package p1;
public class A{
  protected long k(){ return 85; }
  public long m() {
    return k();
  }
}
package p2;
import p1.*;
public class B extends A{
  protected long k(){return 77;}
}
Comment 1 Noopur Gupta CLA 2013-02-05 06:52:05 EST
Tested with Build ID: I20130204-1400.
The bug is reproducible.
Comment 2 Eclipse Genie CLA 2020-03-10 12:38:55 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.