eclipse重构 - 上拉方法进行界面 [英] eclipse refactoring - pull up method to interface

查看:152
本文介绍了eclipse重构 - 上拉方法进行界面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改eclipse的默认行为,以便它不会将其引用到public abstract的接口的方法前面添加

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"

示例,我有a
class A
实现
接口IA 。假设我向A添加了一个方法 void a(),我右键单击该方法,然后选择Refactor-> Pull Up,而不是确保 void a()被选中,我选择接口IA ,然后单击确定,一个名为 public抽象void a(); 在IA中创建,我想摆脱 public abstract bit。

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.

有没有办法这样做?

谢谢

推荐答案

我只是看着同样的事情,看看它是否改变了,我发现了你的问题。其实这是 Eclipse Bug 71627 。然而,有一个简单的工作:而不是使用 Refactor-> Pull Up ,在超级界面X中使用快速修复(Ctrl + 1) - >创建'method()' >。

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.

它还具有直接引导您直接使用新方法声明的优点,以便您可以直接编写javadoc,更改参数名称等。

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.

这篇关于eclipse重构 - 上拉方法进行界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆