Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java refactoring tools [duplicate]

Possible Duplicate:
A tool like ReSharper, but for 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?

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.

like image 947
Dónal Avatar asked Apr 02 '09 03:04

Dónal


People also ask

How to refactor Java code in Visual Studio Code?

The Java Language Support for VS Code provides many easily accessible refactoring options. Refactoring commands are available from the context menu of the editor. Select the element you want to refactor, right-click to open the context menu, and choose Refactor...: Then you will see all the available refactoring options.

Why is Java refactoring important?

Having Java source code that is understandable helps ensure a system is maintainable and extensible. This paper describes the refactoring process of Java applications in general and some of the benefits of using automated tools to reliably enhance code quality by safely performing refactoring tasks.

What is refactoring in software development?

The refactoring process aims to reduce this conflict, by aiding non destructive changes to the structure of the source code, in order to increase code clarity and maintainability. However many developers and managers are hesitant to use refactoring.

How to use refactoring commands in the editor?

Refactoring commands are available from the context menu of the editor. Select the element you want to refactor, right-click to open the context menu, and choose Refactor...: Then you will see all the available refactoring options. Assigns an expression to a local variable or a field.


2 Answers

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!

like image 52
AaronG Avatar answered Sep 21 '22 02:09

AaronG


I agree with nevster that 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.

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

  • 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)

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

like image 33
Varkhan Avatar answered Sep 21 '22 02:09

Varkhan