RFR: 1542: Census Namespace missing hashCode and equals
Erik Joelsson
erikj at openjdk.org
Thu Aug 11 21:33:16 UTC 2022
On Thu, 11 Aug 2022 21:24:47 GMT, Joe Darcy <darcy at openjdk.org> wrote:
>> The Namespace class is missing hashCode and equals. This patch adds implementations for those two methods. The other data classes in the Census module already have them.
>>
>> This is preventing the change in [SKARA-1529](https://bugs.openjdk.org/browse/SKARA-1529) from actually taking effect, as we can't compare two instances of Namespace to see if they have the same contents.
>
> census/src/main/java/org/openjdk/skara/census/Namespace.java line 100:
>
>> 98: return true;
>> 99: }
>> 100: if (o == null || getClass() != o.getClass()) {
>
> The "same type" check could be phrased differently using instanceof, but what you have here should work okay too.
Hm, I let the IDE generate these for me so didn't think much of it. Aren't there subtle differences with instanceof, if there are subtypes involved? Not that it matters in this particular instance.
-------------
PR: https://git.openjdk.org/skara/pull/1356
More information about the skara-dev
mailing list