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

Bug 530963

Summary: [refactoring] Pull Up Method makes a class abstract and does not remove method from its origin class
Product: [Eclipse Project] JDT Reporter: Jonhnanthan Oliveira <jonhnanthan>
Component: UIAssignee: Jeff Johnston <jjohnstn>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: jjohnstn
Version: 4.5.2   
Target Milestone: 4.11 M3   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Jonhnanthan Oliveira CLA 2018-02-09 13:30:49 EST
Applying pull up method refactoring to move B.m to class A, makes A abstract and do not remove the method from B. Making a class abstract may be not safe in some domains, such as library (API) developments. Even, in other domains, the developer may not want to make a class abstract. I think at least Eclipse should report a message to allow the user choosing between make a class abstract or give up the transformation. Furthermore, Eclipse does not remove the method from B. It is an error of the refactoring application. The Pull Up Method intention is related to remove the method from subclass and insert in the superclass.

--- Before Refactoring:

public class A {}

public abstract class B extends A {
    abstract long m();
}

--- Resulting Program:

public abstract class A {
    abstract long m();
}

public abstract class B extends A {
    abstract long m();
}
Comment 1 Jeff Johnston CLA 2019-01-23 15:16:10 EST
Using latest JDT 4.11 master repo and clicking on the Pull Up... refactoring for method m in B:

1. the abstract long m() declaration in B is removed
2. the changing of class A to abstract and the removal from B are both
   previewed so the user can choose to cancel

Resolving as WORKSFORME.
Comment 2 Jeff Johnston CLA 2019-01-23 15:51:57 EST
Marking as CLOSED instead of RESOLVED.