Menu

#47 Bug - equals() methods overload instead of override Object.equals()

1.0
closed
None
2015-04-15
2015-04-15
Malcolm
No

Some implementation of equals() methods are implemented as equals(SomeObjectType) instead of equals(Object). Thus they overload Object.equals(Object) instead of overriding it, and consequently strange behaviour is occurring.

Known cases:
* QueryableDatatype.equals(QueryableDatatype)
* DBOperator.equals(DBOperator)

I've committed nz.co.gregs.dbvolution.datatypes.DBIntegerTest showing a bug whereby DBInteger.equals() doesn't work correctly. The failing test case is @Ignore'd at the moment.

"@Override" annotation should be added to all equals() methods throughout DBv codebase to avoid this.

Discussion

  • Gregory Graham

    Gregory Graham - 2015-04-15
    • status: open --> accepted
     
  • Malcolm

    Malcolm - 2015-04-15
    • summary: Bugs in equals() methods --> Bug - equals() methods overload instead of override Object.equals()
    • status: accepted --> open
     
  • Gregory Graham

    Gregory Graham - 2015-04-15
    • status: open --> accepted
     
  • Gregory Graham

    Gregory Graham - 2015-04-15

    Well spotted and excellent write-up.

    This is obviously not something I have done before but it's definitely a valid operation.

     
  • Gregory Graham

    Gregory Graham - 2015-04-15

    I've changed all the equals(*) methods to equals(Object)

     
  • Gregory Graham

    Gregory Graham - 2015-04-15
    • status: accepted --> closed
     

Anonymous
Anonymous

Add attachments
Cancel