I don't think we need to instantiate a new collection here. The generated code should also check whether the target getter returns null. I'll change both when applying the PR.