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: Lucene.Net.Util.Fst: Added class constraint on all generics #581

Merged
merged 3 commits into from
Dec 20, 2021

Conversation

NightOwl888
Copy link
Contributor

This reverts Lucene.Net.Util.Fst to be more like the original design, using reference types as the generic closing type for generic classes and methods. It reverts to the original reference equality checking that Lucene uses. It also adds a class constraint on all of the generic types to enforce this, as using value types is incompatible with the reference equality checks.

The original design of FST uses reference equality to compare output values. There are also extensions to FST in Lucene.Net.Misc that declare the generic type as object so either a long integer type or another reference type can be returned.

This had been changed to use long? as the generic closing type and the reference equality checking was changed to value equality checking. This of course meant that boxing would take place in the Lucene.Net.Misc extensions and also made it impossible to use long instead of long? as the generic closing type because of how equality was being compared, which made the API confusing to use.

NOTE: There are numeric reference type wrappers in the J2N.Numerics namespace that can be used with this API. The built-in implementation uses J2N.Numerics.Int64.

This PR also adds a MoveNext() method to the Lucene.Net.Util.Fst.Int32sRefFSTEnum and deprecates the Next() method (see #279).

…instead of long? as it was designed to use reference equality.
…c FST type and reverted to reference equality comparisons.
…ked Next() method obsolete. See apache#279. This change had already been done to BytesRefFSTEnum, which made them inconsistent.
@NightOwl888 NightOwl888 merged commit 8b8ec3b into apache:master Dec 20, 2021
NightOwl888 added a commit that referenced this pull request Dec 20, 2021
#581) (#583)

* BREAKING: Lucene.Net.Queries.Function.ValueSources.EnumFieldSource: Removed nullable value types from public API

* Lucene.Net.Queries: Removed unnecessary nullable value types

* SWEEP: Removed several unnecessary nullable value type declarations in the test framework and in tests

* BREAKING: Lucene.Net.QueryParsers.Flexible: Removed unnecessary nullable value types from ConfigurationKeys and configuration setters/getters in StandardQueryParser. Added AbstractQueryConfig.TryGetValue() method to allow retrieving value types so they can be defaulted properly.
@NightOwl888 NightOwl888 added this to the 4.8.0-beta00016 milestone Feb 12, 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.

1 participant