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

Covariant return types for intersect methods #107

Merged
merged 1 commit into from
Oct 25, 2022

Conversation

prdoyle
Copy link
Contributor

@prdoyle prdoyle commented Oct 21, 2022

The minusAll method is overridden in subtypes of PSet so that it returns those particular subtypes.

This PR does the same for intersect.

Implementation notes

The DRY principle would suggest that the subtypes should call the super version of the method. However, this would require a downcast. I opted instead to just duplicate the one-liner method implementation, but perhaps the downcast would be cleaner?

@hrldcpr
Copy link
Owner

hrldcpr commented Oct 25, 2022

Looks good, thanks!

@hrldcpr hrldcpr merged commit f3a1918 into hrldcpr:master Oct 25, 2022
@hrldcpr
Copy link
Owner

hrldcpr commented Oct 28, 2022

Released as v4.0.1 - https://central.sonatype.dev/artifact/org.pcollections/pcollections/4.0.1

@prdoyle When you get a chance, perhaps you can check if this new release works as expected in your project, since it's packaged and published differently than before (thanks to #109)

@prdoyle
Copy link
Contributor Author

prdoyle commented Oct 31, 2022

@hrldcpr - I checked. Worked as expected!

@hrldcpr
Copy link
Owner

hrldcpr commented Oct 31, 2022

@prdoyle Great, thanks!

@prdoyle prdoyle deleted the covariant-intersect branch January 6, 2023 04:32
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.

3 participants