You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@opennlp.apache.org by "Martin Wiesner (Jira)" <ji...@apache.org> on 2023/02/19 12:46:00 UTC
[jira] [Updated] (OPENNLP-1471) Ensure Dictionary#asStringSet() implements hashCode() and equals() correctly
[ https://issues.apache.org/jira/browse/OPENNLP-1471?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Wiesner updated OPENNLP-1471:
------------------------------------
Description:
The tests (a) {{DictionaryAsSetCaseInsensitiveTest}} and
{{(b) DictionaryAsSetCaseSensitiveTest}} have an open TODO that points to a bug in Dictionary#asStringSet()
{quote}// TODO: should it be equal??
Assertions.assertNotSame(setA.hashCode(), setB.hashCode());
{quote}
To cure this, the implementation of Dictionary#asStringSet() needs override hashCode and equals properly.
After fixing the implementation, the following assertion must hold:
{quote}Assertions.assertEquals(setA, setB);
Assertions.assertEquals(setA.hashCode(), setB.hashCode());
{quote}
where setA and setB are obtained via {{{}Dictionary#asStringSet(){}}}.
was:
The tests (i) {{DictionaryAsSetCaseInsensitiveTest}} and
{{(ii) DictionaryAsSetCaseSensitiveTest}} have an open TODO that points to a bug in Dictionary#asStringSet()
{quote}// TODO: should it be equal??
Assertions.assertNotSame(setA.hashCode(), setB.hashCode());
{quote}
To cure this, the implementation of Dictionary#asStringSet() needs override hashCode and equals properly.
After fixing the implementation, the following assertion must hold:
{quote}Assertions.assertEquals(setA, setB);
Assertions.assertEquals(setA.hashCode(), setB.hashCode());
{quote}
where setA and setB are obtained via {{Dictionary#asStringSet()}}.
> Ensure Dictionary#asStringSet() implements hashCode() and equals() correctly
> ----------------------------------------------------------------------------
>
> Key: OPENNLP-1471
> URL: https://issues.apache.org/jira/browse/OPENNLP-1471
> Project: OpenNLP
> Issue Type: Improvement
> Affects Versions: 2.1.0, 2.1.1
> Reporter: Martin Wiesner
> Assignee: Martin Wiesner
> Priority: Minor
>
> The tests (a) {{DictionaryAsSetCaseInsensitiveTest}} and
> {{(b) DictionaryAsSetCaseSensitiveTest}} have an open TODO that points to a bug in Dictionary#asStringSet()
>
> {quote}// TODO: should it be equal??
> Assertions.assertNotSame(setA.hashCode(), setB.hashCode());
> {quote}
> To cure this, the implementation of Dictionary#asStringSet() needs override hashCode and equals properly.
> After fixing the implementation, the following assertion must hold:
> {quote}Assertions.assertEquals(setA, setB);
> Assertions.assertEquals(setA.hashCode(), setB.hashCode());
> {quote}
> where setA and setB are obtained via {{{}Dictionary#asStringSet(){}}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)