RFR: 1542: Census Namespace missing hashCode and equals [v2]

Erik Joelsson erikj at openjdk.org
Thu Aug 11 21:42:23 UTC 2022

On Thu, 11 Aug 2022 21:29:39 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> 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.

So I experimented some more. In the intellij wizard for this, if I check "accept subclasses", it generates code with `instanceof` instead. I don't think this equals method should do that.


PR: https://git.openjdk.org/skara/pull/1356

More information about the skara-dev mailing list