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

BREAKING: Remove covariance and LINQ use from Grouping, #1059 #1066

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

paulirwin
Copy link
Contributor

@paulirwin paulirwin commented Dec 15, 2024

  • You've read the Contributor Guide and Code of Conduct.
  • You've included unit or integration tests for your change, where applicable.
  • You've included inline docs for your change, where applicable.
  • There's an open issue for the PR that you are making. If you'd like to propose a change, please open an issue to discuss the change or find an existing issue.

Removes the covariance and LINQ use from Grouping, breaks GroupingSearch into subclasses

Fixes #1059

Description

See #1059 for rationale. This PR breaks GroupingSearch into three child classes (with some abstract base classes for common configuration properties) so that we can remove the covariance in the interfaces that were added to get this working in the original port. This keeps most of the interfaces but makes them non-generic (and thus, not covariant) for cases where you might need to have them in a common variable or collection. These were also needed for usage in the tests, where the test code randomly switches implementations that otherwise would not have common generic type parameters.

LINQ was removed, and IEnumerable<T> was changed to ICollection<T>/IList<T> to match the original Java code. This should improve performance a little bit by being able to reference Count etc. directly.

@paulirwin paulirwin added the notes:breaking-change Has changes that will break backward compatibility label Dec 15, 2024
@paulirwin paulirwin marked this pull request as ready for review December 15, 2024 23:24
This still needs XML doc comments, but this breaks the GroupingSearch
"god class" into three subclasses that implement a common abstract
class. This should allow us to not need covariant interfaces for the
return types.

In order to randomly switch between these classes with incompatible
generic type arguments, the test shows how you can use a delegate to
work around this limitation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notes:breaking-change Has changes that will break backward compatibility
Projects
None yet
1 participant