Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eclipse refactoring - pull up method to interface

How can I change the default behaviour of eclipse so that it does not prepend the methods it pulls up to an interface with "public abstract"

example, I have a class A that implements interface IA. Suppose I added a method void a() to A, and I right click on that method, and select "Refactor->Pull Up", and than make sure void a () is selected and I choose the interface IA, and click ok, a method called public abstract void a(); gets created in IA, I want to get rid of the public abstract bit.

Is there a way to do that?

Thank You

like image 604
Charbel Avatar asked Dec 16 '11 16:12

Charbel


People also ask

How do I Refactor a method in Eclipse?

Changing a Method Signature Select the method or place the cursor somewhere inside. Right-click and choose Refactor > Change Method Signature.

Does Eclipse support refactoring?

In particular, EMF Refactor supports metrics reporting, smell detection, and refactoring for models being based on the Eclipse Modeling Framework, a widely used open source technology in model-based software development.

How do I move a method to another class in Eclipse?

To move this method to the new class, highlight the method's name and select Refactor→ Move, or right-click and select Refactor→ Move, opening the Move Static Member(s) dialog shown in Figure 4-5. In Eclipse, you can move a static method, static field, or instance method using refactoring.

What are the types of refactoring in Eclipse?

Refactoring using Eclipse Right clicking on a Java element in the Package Explorer view and selecting Refactor menu item. Right clicking on a Java element in the Java editor and selecting Refactor menu item. Selecting a Java element in either the Package Explorer view or Java Editor and clicking Shift + Alt + T.


1 Answers

I was just looking at the same thing to see if it had changed and I found your question. In fact this is Eclipse Bug 71627. However there is a simple work around: instead of using Refactor->Pull Up, use Quick fix (Ctrl+1)->Create 'method()' in super interface X.

It also has the advantage that it leads you directly to the new method declaration, so that you can directly write the javadoc, change parameter names etc.

like image 65
Didier L Avatar answered Oct 03 '22 06:10

Didier L