You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2020/07/31 14:00:33 UTC

[GitHub] [groovy] paulk-asert commented on pull request #1332: GROOVY-9666: ConcurrentModificationException when processing ModuleNo…

paulk-asert commented 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
   ```
   


----------------------------------------------------------------
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:
users@infra.apache.org