Consider the following:
config.groovy:
withConfig(configuration) {
imports {
star 'groovy.transform'
alias 'Regexp', 'java.util.regex.Pattern'
}
}
One.groovy:
@Canonical
class One {
String string
Number number
private Regexp pattern
void setPattern(Regexp pattern) {
this.pattern = pattern
}
}
Tests.groovy:
@CompileStatic
final class Tests {
@Test
void testCtors() {
def one = new One('value') // error: Cannot find matching method ...
def two = new Two('value')
}
}
@Canonical @CompileStatic
class Two {
String value
}
Organize imports (Ctrl+Shift+O) on Tests.groovy is adding the import statement import java.util.regex.Pattern as Regexp to the source.
Consider the following:
config.groovy:
withConfig(configuration) { imports { star 'groovy.transform' alias 'Regexp', 'java.util.regex.Pattern' } }One.groovy:
Tests.groovy:
Organize imports (Ctrl+Shift+O) on Tests.groovy is adding the import statement
import java.util.regex.Pattern as Regexpto the source.