paulk-asert edited a comment on pull request #1332:
URL: https://github.com/apache/groovy/pull/1332#issuecomment-667134508
The following all fail for me in 3.0.5:
```
import org.codehaus.groovy.ast.ModuleNode
import org.codehaus.groovy.control.SourceUnit
import org.codehaus.groovy.ast.ClassHelper
def mn = new ModuleNode((SourceUnit)null)
mn.addStarImport('foo.bar')
assert mn.starImports.size() == 1
for (starImport in mn.starImports) {
mn.addStarImport(starImport.packageName.toUpperCase())
}
assert mn.starImports.size() == 2
mn.addStaticStarImport('Integer', ClassHelper.Integer_TYPE)
mn.addStaticStarImport('Long', ClassHelper.Integer_TYPE)
assert mn.staticStarImports.size() == 2
for (staticStarImport in mn.staticStarImports) {
mn.addStaticStarImport('Short', ClassHelper.Long_TYPE)
}
assert mn.staticStarImports.size() == 4
mn.addStaticImport(ClassHelper.Integer_TYPE, 'MIN_VALUE', 'MIN_VALUE')
mn.addStaticImport(ClassHelper.Long_TYPE, 'MIN_VALUE', 'MIN_VALUE')
assert mn.staticImports.size() == 2
for (staticImport in mn.staticImports) {
mn.addStaticImport(staticImport.value.type, 'MAX_VALUE', 'MAX_VALUE')
}
assert mn.staticImports.size() == 4
mn.addImport('Integer', ClassHelper.Integer_TYPE)
assert mn.imports.size() == 1
for (importNode in mn.imports) {
mn.addImport('Natural', ClassHelper.Integer_TYPE)
}
assert mn.imports.size() == 2
mn.addMethod(null)
assert mn.methods.size() == 1
for (method in mn.methods) {
mn.addMethod(null)
}
assert mn.methods.size() == 2
```
You are correct that most also failed on 3.0.4 but if we are going to
support that style for `addImport`, we should probably be consistent.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]