Thanks for the null-check tip! I appreciate that.
As a matter of fact, NPE issue still bothers us a lot. This recent PR from the community
is another
validation: https://github.com/hibernate/hibernate-orm/pull/3499How to
systematically combat NPE is a good topic and still highly relevant. Maybe we can talk
about it later.
I didn't anticipate we should abandon the 'lazy initialization' pattern
totally (even when we limited its scope to ArrayList constructed by default constructor).
My point is to raise the awareness that since JDK7, ArrayList has a lazy-initialization
feature built-in already. We still pay the cost to create an empty ArrayList (without
allocating 10 elements in advance), but the overhead might be worthwhile for it leads to a
more elegant and maintainable codebase.