Groovy code - import statement not needed?

groovy, java

Solution

No imports are not inherited between classes.

In `Groovy` all of the below packages are imported by default.

- java.io.*

- java.lang.*

- java.math.BigDecimal

- java.math.BigInteger

- java.net.*

- java.util.* (which includes `Collection`)

- groovy.lang.*

- groovy.util.*

Problem

I created a groovy class with a method that returns `Collection<String>`. It works, but it's weird that there is no `Collection` in the import statements. The class inherits a super class. That super class (java) does have the import statement for collection: `import java.util.Collection;` Is it the expected behavior? Does java or groovy inherit imports too? I doubt that.

Original source