You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
somewhat related to #122, I'd like to propose allowing collections to become nullable, because right now useImmutableCollections = true does two things
it adds the conversion to immutable collections (awesome!)
but also enforces that the output record can never have the collection values nullable
I'm proposing to change the behaviour based on interpretNotNulls value.
I started working on this and so far I got to a point where record components return null when a new useNullableCollections option is set to true (default is false for backwards compatibility). It does not yet take into account if nulls are interpreted or not.
I decided to create a new option for it to not break any existing code as I'd not be surprised if library users were relying on these collection/list/set/map components always being non-null. Please let me know if it should be done otherwise.
* Support nullable collections based on 'allowNullableCollections' and 'interpretNotNulls' options
* nit & typos
* Emit warning if allowNullableCollections is used in combination with non-specialized collections
---------
Co-authored-by: Dominik Hoftych <[email protected]>
Hi,
somewhat related to #122, I'd like to propose allowing collections to become nullable, because right now
useImmutableCollections = true
does two thingsI'm proposing to change the behaviour based on
interpretNotNulls
value.useImmutableCollections = true && interpretNotNulls = false
return (o != null) ? Map.copyOf(o) : null;
useImmutableCollections = true && interpretNotNulls = true
return (o != null) ? Map.copyOf(o) : null;
return (o != null) ? Map.copyOf(o) : Map.of();
useImmutableCollections = true
This should also (consistently) affect the default value for collections mentioned in #122
The text was updated successfully, but these errors were encountered: