You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by metlos <gi...@git.apache.org> on 2016/12/21 10:54:29 UTC

[GitHub] tinkerpop pull request #518: Honor the equals() contract on Property impls b...

GitHub user metlos opened a pull request:

    https://github.com/apache/tinkerpop/pull/518

    Honor the equals() contract on Property impls by allowing nulls as valid comparisons.

    If user code put the properties into some kind of collection together with `null` values, things would blow up.
    
    Note that `ElementHelper.areEqual(Element, Object)` allows for `null` values, but `ElementHelper.areEqual(Property, Object)` does not. I assume the reason for this discrepancy is that properties are never supposed to be null but merely not present.
    
    While this assumption is valid in Tinkerpop impl, I think it cannot be imposed on the user code, which assumes a valid implementation of `equals()` which *should not* blow up on null arguments.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/metlos/tinkerpop null-equality-on-props

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tinkerpop/pull/518.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #518
    
----
commit a0b604c10f3ffbf96fbe444bc5059e2c9d0030a3
Author: Lukas Krejci <lk...@redhat.com>
Date:   2016-12-21T10:34:34Z

    Honor the equals() contract on Property impls by allowing nulls as valid
    comparisons.
    
    If user code put the properties into some kind of collection together with
    null values, things would blow up.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop issue #518: Honor the equals() contract on Property impls by allow...

Posted by okram <gi...@git.apache.org>.
Github user okram commented on the issue:

    https://github.com/apache/tinkerpop/pull/518
  
    Yea, I would put the null check into `ElementHelper.areEqual()` so all providers have the same semantics. Then I would add a structure test to verifies that null is okay for `equals()` for every element type: vertex, edge, property, vertex property.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop issue #518: Honor the equals() contract on Property impls by allow...

Posted by metlos <gi...@git.apache.org>.
Github user metlos commented on the issue:

    https://github.com/apache/tinkerpop/pull/518
  
    Created #519 with the updates as suggested here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop pull request #518: Honor the equals() contract on Property impls b...

Posted by metlos <gi...@git.apache.org>.
Github user metlos closed the pull request at:

    https://github.com/apache/tinkerpop/pull/518


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop issue #518: Honor the equals() contract on Property impls by allow...

Posted by spmallette <gi...@git.apache.org>.
Github user spmallette commented on the issue:

    https://github.com/apache/tinkerpop/pull/518
  
    Thanks @okram 
    
    @metlos please also target the tp32 branch instead of master.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop issue #518: Honor the equals() contract on Property impls by allow...

Posted by metlos <gi...@git.apache.org>.
Github user metlos commented on the issue:

    https://github.com/apache/tinkerpop/pull/518
  
    Thanks for the feedback. I'm closing this PR then and will target the reworked patch to tp32.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] tinkerpop issue #518: Honor the equals() contract on Property impls by allow...

Posted by spmallette <gi...@git.apache.org>.
Github user spmallette commented on the issue:

    https://github.com/apache/tinkerpop/pull/518
  
    hmmm - i'm not sure why `ElementHelper.areEqual(Property, Object)` needs to throw exceptions for null situations. i'm not so sure that's really how it should work. In studying some of the usage, I don't see where that's really valuable logic. I think the better fix is to just to make `ElementHelper.areEqual(Property, Object)` handle nulls properly like the other `areEqual()` methods.  @okram any problems taking that approach?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---