[ https://issues.apache.org/jira/browse/TINKERPOP-1259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15234342#comment-15234342 ]
pieter martin commented on TINKERPOP-1259: ------------------------------------------ Ok, had another look. So my first analysis was wrong, but I still think its a problem with TinkerPop. {{DetachedVertexProperty}}'s {{hashCode()}} calls the inherited {{DetachedElement}}'s {{hashCode()}} which is calling {code} element.id().hashCode() {code} However it should be calling {code} property.key().hashCode() + property.value().hashCode() {code} It will call this if {{DetachedVertexProperty}} has its own {{hashCode()}} method {code} @Override public int hashCode() { return ElementHelper.hashCode((Property)this); } {code} in which case the correct hashCode is returned and the test passes in Sqlg. > SerializationTest.shouldSerializeTree fails due to id() and hashCode() > ---------------------------------------------------------------------- > > Key: TINKERPOP-1259 > URL: https://issues.apache.org/jira/browse/TINKERPOP-1259 > Project: TinkerPop > Issue Type: Bug > Components: test-suite > Affects Versions: 3.2.1 > Reporter: pieter martin > > The tests fails on the last > {code} > assertEquals("The objects differ", after, before) > {code} > The 2 trees are however correct but due to differences in the > {{DetachedVertexProperty}} and {{SqlgVertexProperty}} {{id()}}, {{equals()}} > and {{hashCode()}} implementation the 2 trees are not equal. > {{DetachedVertexProperty}} uses the {{element}}'s {{id}} as its {{id}} and > that is used in the {{equals}} and {{hashCode}} method basically making a > property equal to an element. > {{SqlgVertexProperty}} has a more sophisticated {{id()}} > {code} > return (long) (this.key().hashCode() + this.value().hashCode() + > this.element().id().hashCode()) > {code} > If I change this to be the same as {{DetachedVertexProperty}} then the test > passes but I am not sure that it would be correct. -- This message was sent by Atlassian JIRA (v6.3.4#6332)