Skip to content

Organize imports adds config script alias import #709

@eric-milles

Description

@eric-milles

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.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions