Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6381

Couldnt initialize arraylist of arraylists

    XMLWordPrintableJSON

Details

    • Test
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • Groovlet / GSP
    • None

    Description

      class MainClass {
        List<MSID> MainList = [].withLazyDefault { return new MSID() } 
      }
      
      class MSID{
        List<Item> subList = [].withLazyDefault { return new Item() }	 
      }
      

      And in controller when I say

      MainClass mainObj; 
      .....
      List<Item> listWithoutNullValues = mainObj.MainList.subList.grep()
      for(Item provision : listWithoutNullValues){
        println provision.someValue
      }
      
      Cannot cast object 'groovy.lang.ListWithDefault@1d9e316' with class 'groovy.lang.ListWithDefault' to class 'com.abc.Item'
        due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            catherinecgtest Catherine A
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: