ok so you mean make sure both hashCode and equals work on Dir + version? I think segFileName is better too, at least it makes it more clear. But I assumed version is used for a reason in equals() and there's a specific jdoc about it ...
But if Dir + segFileName is safe (seems like it), I think we should make both of them use it? Shai On Wed, Apr 28, 2010 at 3:34 PM, Mark Miller <[email protected]> wrote: > On 4/28/10 8:21 AM, Shai Erera wrote: > >> Hi >> >> According to Java's hashCode jdoc, if two objects answer true to >> o1.equals(o2), then o1.hashCode() == o2.hashCode(). However, IC uses Dir >> + segmentFileName in hashCode() and Dir + version in equals(). More so, >> the jdoc of equals specifies that two IC equals if their Dirs are equals >> and the have the same version. >> >> I think this should be fixed? >> >> But what is the right criteria: Dir + version || Dir + segFileName || >> Dir + version + segFileName? >> >> Shai >> > > > Looks like Dir + version is enough? But perhaps Dir + segFileName is better > - its odd to rely on getVersion for this in the abstract base class - it can > throw UnsupportedOperationException unless a subclass chooses to implement > it. > > -- > - Mark > > http://www.lucidimagination.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
