Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix addSingleItemCollectionBuilders when useImmutableCollections is false #130

Closed
wants to merge 1 commit into from

Conversation

Randgalt
Copy link
Owner

  • Removed SingleItemsMetaDataMode.STANDARD as it wasn't used
  • Removed needs*MutableMaker - always add them when corresponding needs*Shim is true
  • Merged addMutableMakers() into addShims()
  • Always use mutable makers when addSingleItemCollectionBuilders is true

Fixes #129

cc @mads-b, @freelon, @tmichel

…alse

- Removed `SingleItemsMetaDataMode.STANDARD` as it wasn't used
- Removed `needs*MutableMaker` - always add them when corresponding `needs*Shim` is true
- Merged `addMutableMakers()` into `addShims()`
- Always use mutable makers when addSingleItemCollectionBuilders is true

Fixes #129
@Randgalt Randgalt added this to the v35 milestone Oct 19, 2022
@freelon
Copy link
Contributor

freelon commented Oct 26, 2022

  • needs*Shim is now used for shim and mutable makers. It should be renamed to reflect its meaning.
  • if only addSingleItemCollectionBuildersis true (i.e. lists are mutable) the setters for collections always create an immutable copy of the collection passed to it
    • if an item is added to that list another copy is made to make it mutable again
    • not sure what's the way to go here, but I'd prefer to be still able to set a fixed list instance (see this discussion for a more explicit way of creating a new list with all items of a collection (clear and addAll))

@freelon
Copy link
Contributor

freelon commented Oct 26, 2022

On a separate note, now if I use the collection setter (addSingleItemCollectionBuilders=true) with e.g. an ArrayList I'll get an exception later if I try myRecords.someList().add(...) because it became immutable without me asking for immutable lists..

@Randgalt
Copy link
Owner Author

Randgalt commented Oct 29, 2022

I see - these two features may be hopelessly broken: addSingleItemCollectionBuilders is the real troublesome one. I'll think more about this and possibly do something similar to this

@Randgalt Randgalt closed this Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aa027af causes compile errors
2 participants