- Create a Java interface you want to instantiate in a Groovy script. For example:

- Open the desired Groovy script for editing, and type the following code:

As you see, IntelliJ IDEA highlights this code as erroneous.
- Press Alt+EnterAlt+Enter to reveal the quick fix, and click Dynamize invalid interface instantiation.
- Depending on the number of methods in the Java interface, the further behavior is different:
- Java interface contains two or more methods. In this case, you have to specify which methods
should be implemented:

The instantiation code is converted to a map:

- Java interface contains a single method. In this case, the instantiation code is converted
silently to a closure:

- Java interface contains two or more methods. In this case, you have to specify which methods
should be implemented:

