eclipse Java 重构工具

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/708164/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 13:38:05  来源:igfitidea点击:

Java refactoring tools

javaeclipserefactoringeclipse-jdt

提问by Dónal

Possible Duplicate:
A tool like ReSharper, but for Java?

可能的重复:
像 ReSharper 这样的工具,但适用于 Java?

I make very heavy use of the Java code refactoring tools provided by Eclipse (extract interface, rename method, etc.). Does anyone knows of other similar tools (preferably Eclipse plugins) that can perform Java code refactorings that are not available in Eclipse by default, or that can perform the same refactorings better?

我大量使用 Eclipse 提供的 Java 代码重构工具(提取接口、重命名方法等)。有谁知道其他类似的工具(最好是 Eclipse 插件)可以执行默认情况下在 Eclipse 中不可用的 Java 代码重构,或者可以更好地执行相同的重构?

I'm aware of various Eclipse plugins that can identify code in need of refactoring (e.g. FindBugs, UCDetector), but I'm looking for tools that can actually do the refactoring.

我知道可以识别需要重构的代码的各种 Eclipse 插件(例如 FindBugs、UCDetector),但我正在寻找可以实际进行重构的工具。

回答by AaronG

RefactorIT... Is available as standalone product and Eclipse plugin. Only con is that for non-open source projects you are limited to 50 classes (but can get around that by splitting into multiple Eclipse projects, and using dependencies). RefactorIT also has code generation tools, like 'Encapsulate Field', where you select (multiple) fields in the package view (wherever) and it automatically creates getters and/or setters, also same thing for Constructors... Great tool!

RefactorIT... 可作为独立产品和 Eclipse 插件使用。唯一的缺点是对于非开源项目,您被限制为 50 个类(但可以通过拆分为多个 Eclipse 项目并使用依赖项来解决这个问题)。RefactorIT 也有代码生成工具,比如“Encapsulate Field”,你可以在包视图中选择(多个)字段(无论在哪里),它会自动创建 getter 和/或 setter,对于构造函数也是一样的......很棒的工具!

回答by nevster

Well you can try out IntelliJ for free to get a feel for everything it can do. It satisfies your "not available in Eclipse" and "perform the same refactorings better" but obviously not the "preferably Eclipse plugins" :)

好吧,您可以免费试用 IntelliJ,感受一下它的所有功能。它满足您的“在 Eclipse 中不可用”和“更好地执行相同的重构”,但显然不是“最好是 Eclipse 插件”:)

Here's an overview : http://www.jetbrains.com/idea/features/refactoring.html

这是一个概述:http: //www.jetbrains.com/idea/features/refactoring.html

回答by Varkhan

I agree with nevsterthat IntelliJ is much more complete and subtle in its set of refactoring tools. I have been using it for quite a while, and, with automatic code generation (which is essentially the same thing), an extensive refactoring toolkint is the feature that makes it really stand out compared to Eclipse.

我同意nevster 的观点,即 IntelliJ 在其重构工具集上更加完整和微妙。我已经使用它很长一段时间了,并且通过自动代码生成(本质上是相同的东西),广泛的重构工具包是使其与 Eclipse 相比真正脱颖而出的特性。

However, I would not advise so readily moving to IntelliJ, for a number of reasons that can get really irking over time:

但是,我不建议这么容易地转向 IntelliJ,原因有很多,随着时间的推移可能会变得非常烦人:

  • it's not free (I would even say it is expensive)
  • it has a HUGE memory footprint (half a Gb? wtf?) and is slow to start
  • it does not interact well with X-based window managers (to the point of silent data corruption, in some extreme cases)
  • 它不是免费的(我什至会说它很贵)
  • 它有一个巨大的内存占用(半个 Gb?wtf?)并且启动很慢
  • 它不能与基于 X 的窗口管理器很好地交互(在某些极端情况下会导致静默数据损坏)

So you would have to balance the advantages of a better (admittedly, outstandingly so) refactoring toolkit against the weight (literally) of IntelliJ.

因此,您必须在更好(无可否认,非常出色)重构工具包的优势与 IntelliJ 的重量(字面意思)之间进行权衡。