You can even switch between arrays and collections, and the IDE will make all the changes for you. IntelliJ IDEA takes care of automatically applying changes to method return types, local variables, parameters and other data-flow-dependent type entries across the entire project. Have you ever used some type for a long time and then decided to change it? I’m sure you have.
PHPSTORM FIND AND REPLACE CODE
This can be a huge time-saver and a lot of help in keeping your code cleanĪnother useful feature you will rarely find in other IDEs is type migration. When you use it, the IDE offers to apply the corresponding changes to getters and setters, variables, constants, test classes and methods, implementation classes, etc. What could be simpler than the Rename refactoring, you ask? Well, IntelliJ IDEA offers incredible additional support for this refactoring. Try it just once-and you’ll wonder how you’ve lived without it all along. Just apply the refactoring and IntelliJ IDEA willmake appropriate changes to your code to remove duplicates. This feature is available as a separate refactoring, which you can call on any project scope, and as a part of any other refactoring, such as introduce constant, variable, method, etc. Don’t be afraid to apply changes, because you can always roll them back!Īnother thing that makes some developers think IntelliJ IDEA understands their code as well as they do (or better), is detection of code duplicates. IntelliJ IDEA recognizes that you need to rename a JPA entity class, and applies changes to the class and every JPA or other expression in the project - in mere seconds.Īnother aspect that changes the user experince significantly is how safe and easy you can undo any change resulting from even a complicated refactoring, with just one click. This includes SQL expressions database table definitions Spring expressions and annotations and configurations JSF expressions hibernate mappings and more.įor instance, you call the Rename refactoring on a class within a JPA statement. You can safely call refactorings for any statement at the caret, and IntelliJ IDEA will take care of applying the corresponding changes to every piece of code related to the change. It not only recognizes many languages, expressions and dialects (even nested inside each other), but also their relationships within the project. The first and perhaps the most impressive aspect of refactorings in IntelliJ IDEA is its all-encompassing support for languages and frameworks. Out-of-the-box support for languages and frameworks In this article I give an overview of the most important refactoring features that not everyone knows and uses, which make IntelliJ IDEA really shine. It’s great to improve your code quickly, but you’ve got to make sure your changes are safe to the project as a whole. That’s why IntelliJ IDEA has always focused on refactoring productivity and refactoring safety. However, it’s never about the number of refactorings you can use, but rather about how confident you feel using them. Nowadays it’s hard to imagine an IDE that doesn’t provide at least a basic set of refactorings. IntelliJ IDEA was the first Java IDE to implement the extensive set of refactorings worked out and recommended by Martin Fowler, driving other IDEs to offer this feature. Following up on the previous article where we highlighted the top 20 features of Code Completion, I’d like to talk about the top Refactoring features that help make IntelliJ IDEA an extremely useful development tool.