protected IRExpression compileExpansionUsingArrayList( IType rootType, IType rootComponentType, IType resultType, IType resultCompType, IType propertyType ) {
    // Evaluate the root and assign it to a temp variable
    IRSymbol tempRoot = _cc().makeAndIndexTempSymbol( getDescriptor( rootType ) );
    IRStatement tempRootAssignment = buildAssignment( tempRoot, ExpressionTransformer.compile( _expr().getRootExpression(), _cc() ) );

    // Create an ArrayList to store the results
    IRSymbol resultArrayList = _cc().makeAndIndexTempSymbol( getDescriptor( JavaTypes.ARRAY_LIST() ) );
    IRStatement arrayListCreation = buildAssignment(resultArrayList, buildNewExpression( ArrayList.class, new Class[0], exprList() ) );

    // Now we loop over each element in the root array or collection.  For each element, we evaluate the
    // RHS, wrap it by calling arrayToCollection, then add it to the result list via addAll
    IRForEachStatement forLoop = createArrayListAddLoop(rootType, rootComponentType, resultCompType, tempRoot, resultArrayList, propertyType );

    // Now take the ArrayList and convert it to the desired return type
    IRExpression listToArrayConversion = convertListToArray(resultType, resultCompType, resultArrayList);

    return buildComposite( tempRootAssignment, arrayListCreation, forLoop, listToArrayConversion );
  }
protected IRExpression compileExpansionUsingArrayList ( IType rootType , IType rootComponentType , IType resultType , IType resultCompType , IType propertyType ) { IRSymbol tempRoot = _cc ( ) . makeAndIndexTempSymbol ( getDescriptor ( rootType ) ) ; IRStatement tempRootAssignment = buildAssignment ( tempRoot , ExpressionTransformer . compile ( _expr ( ) . getRootExpression ( ) , _cc ( ) ) ) ; IRSymbol resultArrayList = _cc ( ) . makeAndIndexTempSymbol ( getDescriptor ( JavaTypes . ARRAY_LIST ( ) ) ) ; IRStatement arrayListCreation = buildAssignment ( resultArrayList , buildNewExpression ( ArrayList . class , new Class [ 0 ] , exprList ( ) ) ) ; IRForEachStatement forLoop = createArrayListAddLoop ( rootType , rootComponentType , resultCompType , tempRoot , resultArrayList , propertyType ) ; IRExpression listToArrayConversion = convertListToArray ( resultType , resultCompType , resultArrayList ) ; return buildComposite ( tempRootAssignment , arrayListCreation , forLoop , listToArrayConversion ) ; }
This method will compile the expansion using an ArrayList to collect temporary results.  This is appropriate if the right-hand-side
is a Collection or array, if the root is an Iterable or Iterator or other object whose size can't easily be determined up-front,
or if the root is a nested Collection or array that will require additional unwrapping.

The overall result of the expansion thus looks like the following composite:

temp_arraylist = new ArrayList()
for (a in temp_root) {
temp_arraylist.addAll( AbstractMemberExpansionTransform.arrayToCollection( a.Bars ) )
}
AbstractMemberExpansionTransformer.listToArray(temp_array)