Summary: | [1.8][pull up] to interface should not make method abstract | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | John Arthorne <john.arthorne> |
Component: | UI | Assignee: | JDT-UI-Inbox <jdt-ui-inbox> |
Status: | ASSIGNED --- | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | CC: | daniel_megert, jerome.cambon, manju656, markus.kell.r |
Version: | 4.4 | ||
Target Milestone: | --- | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.eclipse.org/bugs/show_bug.cgi?id=137960 | ||
Whiteboard: |
Description
John Arthorne
2014-05-27 22:24:49 EDT
Currently the method is marked as overriden and the abstract method stub is created in the interface. Is it better to provide a check-box to chose what user wants as some user might prefer the current implementation? From a purely user perspective, I could see situations for both behaviours. For example if the method implementation cannot be pulled up due to field references or visibility limits, then pulling up only method signature could be useful (like current behaviour). 1. Similarly we should allow static and default methods to be pulled up between interfaces. public interface InterfaceA extends InterfaceB{ public static void staticM2(){ System.out.println("Something"); } } Invoking pull up on #staticM2 gives error dialog "Members in interfaces cannot be moved". 2. Pull up refactoring from a class to an interface results in compiler error. public class ClassA implements InterfaceA { private static void staticM1() { System.out.println("Something"); } } public interface InterfaceA { ] Invoke pull up refactoring on #staticM1 to InterfaceA, the refactoring results in: protected abstract static void staticM1(); Also @Override annotation is added to the static method in the class. (In reply to Manju Mathew from comment #1) > Is it better to provide a check-box to chose what user wants as some user > might prefer the current implementation? Why a checkbox? We already have the "Action" popup / button. In Java 8, the "pull up" action should pull the method up as a default method. |