本文介绍了如何配置Eclipse以默认创建受保护的java方法而不是私有?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用Eclipse 3.5为我自动创建方法时(例如,通过调用尚不存在的方法,然后使用Quickfix创建方法),Eclipse将创建具有私有范围的方法。

When I use Eclipse 3.5 to auto-create methods for me (for example, by calling a method that does not yet exist, then using Quickfix to create the method), Eclipse creates the method with private scope.

我想改变它,以便默认情况下使用受保护的范围创建它。我怎么能这样做?

I'd like to change that so that it's created with protected scope by default. How can I do so?

推荐答案

已经

现在没办法做到这一点。

请输入功能请求
a。

there's no way to do this now.
Please enter a feature request a.

哎哟。 7年后,对于3.5版本,它似乎没有改变一点。事实上,其他快速修复会产生不正确的私有方法(在另一个上下文中,例如)

Ouch. And 7 years later, for the 3.5 edition, it does not seem to have changed one bit. In fact, other quick fixes produce incorrect private methods (in another context though, like bug 271551)

可以说,在这种情况下,私有方法的生成可以被视为良好实践,迫使开发人员明确提高可见性所述方法的水平(有足够的javadoc说为什么这种方法可以分类或甚至是公开的)

Arguably, in this instance, the generation of private method could be view as a "good practice", forcing the developer to explicitly raise the visibility level of said method (with the adequate javadoc saying why this method could be sub-classed or is even a public one)

这篇关于如何配置Eclipse以默认创建受保护的java方法而不是私有?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 07:45