Code intentions help you simplify your code. They are activated using Alt+Enter.
Here is a complete list of the Groovy intentions available:
Name |
Description |
Before Code |
After Code |
||
---|---|---|---|---|---|
Change To C Style Comment |
This intention converts one of more "end-of-line" comments to block comments. |
|
|
||
Change To End Of Line Comment |
This intention converts a block comment to one or more "end-of-line" comments. |
|
|
||
Conditional To Elvis |
This intention changes appropriate conditional operator to it's Elvis represenation. |
|
|
||
Convert Closure Arg To It |
This converts an implicit call to a closure into an explicit call. |
|
|
||
Convert G String To String |
This intention converts selected GString literal into an equivalent String literal. |
|
|
||
Convert Integer To Decimal |
This intention converts selected integer literal (written in either hexadecimal or octal notation) |
|
|
||
Convert Integer To Hex |
This intention converts selected integer literal (written in either decimal or octal notation) |
|
|
||
Convert Integer To Octal |
This intention converts selected integer literal (written in either decimal or hexadecimal notation) |
|
|
||
Convert Parameter To Map Entry |
This intention converts all occurrences of selected method or closure parameters to appropriate entries of parameter map. |
|
|
||
Convert String To GString |
This intention converts selected String literal into an equivalent GString literal. |
|
|
||
Demorgans Law |
This intention replaces either a || b with !(!a && !b) or a && b with !(!a || !b) inside boolean expression. |
|
|
||
Expand Boolean |
This intention replaces uses of boolean values with equivalent if-then-else statements, |
|
|
||
Flip Comparison |
This intention reverses the order of evaluation of a comparison. |
|
|
||
Flip Conditional |
This intention flips branches of the conditional operator. |
|
|
||
Flip Conjunction |
This intention reverses the order of evaluation of an '&&' or '||' expression. |
|
|
||
For To Each |
This intention replaces selected for..in statement with .each iterator and associated closure. |
|
|
||
Indexed Expression Conversion |
This intention converts access to an indexed value using "[]" to an equivalent call to a ".getAt()" or ".setAt()" method. |
|
|
||
Indexing Method Conversion |
This intention converts access to an indexed value using ".getAt()" or ".setAt()" methods to the equivalent [] form. |
|
|
||
Java Style Properties Invocation |
This intention changes Java-style properties invocation to Groovy-style. |
|
|
||
Make Closure Call Explicit |
This converts an implicit call to a closure into an explicit call. |
|
|
||
Make Closure Call Implicit |
This converts an explicit call to a closure into an implicit call. |
|
|
||
Merge Else If |
This intention merges the else branch of an if-else statement, |
|
|
||
Merge If And |
This intention merges if-else statement inside then-branch of another if-else into one. |
|
|
||
Negate Comparison |
This intention negates a comparison to it's opposite. |
|
|
||
Remove Parentheses From Method Call |
This intention convert a top level method call with parentheses to the equivalent call without parentheses. |
|
|
||
Split Else If |
This intention splits an else-if branch into an equivalent nested if statement. |
|
|