[josm-dev] [PATCH 01/26] Enhance OsmPrimitive a bit
Dave Hansen
dave at sr71.net
Tue Apr 29 15:32:13 BST 2008
On Tue, 2008-04-29 at 15:20 +0200, Frederik Ramm wrote:
> > @Override public final boolean equals(Object obj) {
> > - if (obj == null || getClass() != obj.getClass() || id == 0 ||
> > ((OsmPrimitive)obj).id == 0)
> > + if (obj == null || getClass() != obj.getClass())
> > + return super.equals(obj);
> > + if (id == 0 && ((OsmPrimitive)obj).id == 0)
> > return super.equals(obj);
> > return id == ((OsmPrimitive)obj).id;
> > }
>
> In a case where id == 0 but obj.id != 0, the old code would have
> returned super.equals(obj), while your code returns false. I suspect
> it doesn't matter much - but was that a deliberate change and if yes,
> why?
No, not a deliberate change. Probably just me misreading the code.
But, if I misread it, maybe others do too. :) Probably good to clean it
up.
I'll go fix that, btw...
-- Dave
More information about the josm-dev
mailing list