olabusayoT commented on a change in pull request #237: Fixes DAFFODIL-2142 URL: https://github.com/apache/incubator-daffodil/pull/237#discussion_r295336435
########## File path: daffodil-core/src/main/scala/org/apache/daffodil/dsom/ModelGroup.scala ########## @@ -44,7 +44,7 @@ object ModelGroupFactory { /** * Because of the contexts where this is used, we return a list. That lets users - * flatmap it to get a collection of model groups. Nil for non-model groups, non-Nil for the model group + * flatmap it to get a collection of model groups. It will return non-Nil for the model group * object. There should be only one non-Nil. Review comment: I made updates to both TermFactory and ModelGroup because they should only return a ModelGroup or Term, rather than a list because the callers handle non Model Group/non Term elements. However depending on how the caller handles aforementioned undesirable elements, a flatMap might still be necessary, as is the case with ModelGroup's caller in ComplexType.scala. Undesirable elements in the case are set to Nil, so they can be removed by the flatMap in the caller. So ModelGroupFactory's return still needs to be wrapped in a list. For TermFactory however, this isn't the case, as we remove undesirable elements, rather than doing any processing on them. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services