Closed shollander closed 5 years ago
Hi,
What is value of depth you are using?
Normally, null should not be placed in a collection.
Depth limitation feature has nothing to do with type of the objects. It just counts number of occurrences in the production loop and cuts instantiation, when limit has been reached. In case it will be taking into account type of objects on the tree it will make it hard to predict how it works.
Thanks, Daniil
The value of depth that I am using is 2.
Yes, with depth 2 Podam will produce MyObject (depth 1) -> List -> MyObject (depth 2) -> List -> null (depth 3)
I feel this is not a proper solution, as third party libraries not implementing Collection, List or Map interfaces will be handled differently. Also not much can be done for arrays. Probably, a better solution is to allow to customize object population.
Podam 7.2.2 has been released
If
maxDepth
is set to avoid too many levels of recursion, and the recursive object is located within a collection; then althoughmaxDepth
does prevent recursion beyond the specified depth, it will fill the collection with null values. For example, given this object structure:When
maxDepth
is reached,myObject.children
will be equal to[null, null, null, null, null]
. I don't think this is the usual expected behavior. Normally,null
should not be placed in a collection. I would expect it to just not set any value for thechildren
field at all, leaving it to the class initialization default.