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

Couldnt initialize arraylist of arraylists

    XMLWordPrintableJSON

    Details

    • Type: Test
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Groovlet / GSP
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: