Hi Michael, thanks for reviewing this.
On Tue, Oct 15, 2013 at 12:49 AM, Michael Dürig <[email protected]> wrote: > Hi, > > On 15.10.13 2:42 , [email protected] wrote: > >> Author: tripod >> Date: Tue Oct 15 00:42:21 2013 >> New Revision: 1532157 >> >> URL: http://svn.apache.org/r1532157 >> Log: >> OAK-1086 NodeTypes of successive calls to node.getPrimaryNodetypes() are >> not equal >> >> - implement equals and hashcode based on the CND of the node type >> definition. >> > > [...] > > + @Override >> + public boolean equals(Object o) { >> + if (this == o) return true; >> + if (o instanceof NodeTypeImpl) { >> + return getCnd().equals(((**NodeTypeImpl) o).getCnd()); >> + } else if (o instanceof NodeType) { >> > > Should we even consider this case? If so, below implementation is not > symmetric wrt. e.g. the NodeType implementation of JR2. > I think the semantics of NodeType.equals() should be mentioned in the JCR API. I'm indifferent if we should consider the comparison between 2 different implementations. > I'd rather return false for unknown NodeType instances. > ok. Maybe we could add a NodeTypeComparator() to JCR commons that can do this check. Initially I thought that comparing just the names would be enough, but then it wouldn't work correctly when a 2 nodetypes of different sessions are compared that were modified. for the implementation specific comparison, we could use the revision/hash of the definition tree. > > + try { >> + return getCnd().equals(getCnd((**NodeType) o)); >> + } catch (IOException e) { >> + return false; >> + } >> + } else { >> + return false; >> + } >> + } >> > > Michael > Regards, Toby
