Closed hofiisek closed 1 year ago
Thanks for this. I'll have a look very soon
Thanks for this PR - it looks very good.
I tried a class that only has @RecordBuilder.Options(allowNullableCollections = true)
and it's a NOP regarding specialized collections. Should we emit a warning or error? Or, should allowNullableCollections = true
always imply enabling useImmutableCollections
?
Thanks for this PR - it looks very good.
I tried a class that only has
@RecordBuilder.Options(allowNullableCollections = true)
and it's a NOP regarding specialized collections. Should we emit a warning or error? Or, shouldallowNullableCollections = true
always imply enablinguseImmutableCollections
?
I see, didn't think of that combination before.
Since NOP is the expected behavior in this case (components and builder getters just return whatever you set to them, without any shim calls etc.), I think we can emit a warning that it will have no effect. I'd rather not enableuseImmutableCollections
automatically as it changes behavior and it could possibly break someone's project (even though I would think that the majority uses unmodifiable/immutable collections anyway).
Since NOP is the expected behavior in this case (components and builder getters just return whatever you set to them, without any shim calls etc.), I think we can emit a warning that it will have no effect. I'd rather not enable
useImmutableCollections
automatically as it changes behavior and it could possibly break someone's project (even though I would think that the majority uses unmodifiable/immutable collections anyway).
A warning (or error) would be good. I'd prefer that to doing nothing.
Agree. Added in the last commit :)
Thank you for this
Solves https://github.com/Randgalt/record-builder/issues/123
There's a new
allowNullableCollections
option that does the following:false
(default value for BC), does nothingtrue
andinterpretNotNulls = false
, a list/set/map/collection record component will return null if value is not settrue
andinterpretNotNulls = true
, a list/set/map/collection record component will return null only if it's determined to be nullable, i.e. isn't annotated by any of the not-null patternsAll branches mentioned above should be covered by the
TestNullableCollectionsBuilder
test