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

Inconsistent encoding conflict resolution #1170

Closed
quanticc opened this issue Apr 23, 2020 · 0 comments · Fixed by #1174
Closed

Inconsistent encoding conflict resolution #1170

quanticc opened this issue Apr 23, 2020 · 0 comments · Fixed by #1174

Comments

@quanticc
Copy link
Contributor

I have a type called Possible that I'm @Encoding to support these types of fields:

  • Possible<T>
  • Possible<Optional<T>>
  • Possible<List<T>>

However when encountering a class with a combination of these types, I get an incompatibility warning:

(immutables:incompat) Encoding conflict for attribute 'field', the winning match:
Possible<T> (from PossibleEncoding).
Other applicable: [Possible<List<T>> (from PossibleListEncoding)]

While this warning is expected, the way a winning match is picked changes between builds. I would hope I could assert a certain order of resolution but it doesn't seem to work.

So far my workaround is changing the implementation of Possible<T> to Possible<? extends T>. Is there another approach to guarantee a given resolution order?

quanticc added a commit to quanticc/immutables that referenced this issue May 3, 2020
Close immutables#1170

Respect insertion order when iterating multiple encodings by
using an ArrayListMultimap to store them.
asereda-gs pushed a commit that referenced this issue May 3, 2020
Close #1170

Respect insertion order when iterating multiple encodings by
using an ArrayListMultimap to store them.
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 a pull request may close this issue.

1 participant