IntelliJ IDEA
IntelliJ IDEA – the Leading Java and Kotlin IDE, by JetBrains
What’s Groovy about IntelliJ IDEA 2018.1?
IntelliJ IDEA 2018.1 is coming! With dozens of incredible new features and improvements added already; it’s time to put the icing on the cake and tell you about our enhanced support for Groovy, read on!
First of all, the ability to refactor Groovy files and Groovy modules has been extended. Now you have a new action, that might be very useful when you want to keep your code in Groovy and at the same time benefits from the static compilation. To save you from a lot of time migrating the existing Groovy code, this new refactoring annotates every groovy class in the scope with the @CompileStatic annotation. Also, the IDE will apply fixes with a view to keeping code correct.
This new refactoring action is available from the context menu in the Refactor | Convert to @CompileStatic.
The IDE adds the @CompileDynamic annotation to methods that depend on dynamic language features and which couldn’t be automatically converted.
The IntelliJ IDEA can also refactor your code in a number of ways, to make sure your groovy code will successfully compile statically:
- The IDE adds explicit type coercion when it’s required.
- The IDE adds explicit type to fields when they can be inferred from field initializers.
- The IDE adds an explicit return type to methods. Type will be inferred by data flow analysis of method’s body.
IntelliJ IDEA converts multiple assignments without list literals to assignments with list literals.
Also, now when you convert a Groovy class to a Java class, the IDE removes all groovy.transform.* annotations, e.g. the @CompileStatic annotations.
Additionally, the IDE now reports unnecessary import alias for Groovy files; this new warning works on static imports as well.
Download and try! Feel free to share your feedback here in the comments, on Twitter or submit an issue to our issue tracker.
Happy Developing!