You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by GitBox <gi...@apache.org> on 2019/03/12 09:53:56 UTC

[GitHub] [groovy] nguillaumin opened a new pull request #895: GROOVY-7954 Fix equality check in special case

nguillaumin opened a new pull request #895: GROOVY-7954 Fix equality check in special case
URL: https://github.com/apache/groovy/pull/895
 
 
   Fix equality check with two instances A & B when:
   - A and B implement the same interface but are not of the same class
   - The common interface implements `Comparable`
   
   `DefaultTypeTransformation.compareToWithEqualityCheck(...)` checks for
   assignable classes and use `compareTo()` when assignable on the class
   level, but it doesn't check it on the interface level.
   
   As a result `compareTo()` is not called at the interface level and `-1`
   is returned.  The fix performs an actual equality check instead of
   returning -1.
   
   I added a unit test, but I'm not completely sure of the right structure
   for unit tests so let me know if I should do it differently.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services