Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#476 check for toString() when equals() defined

open
nobody
Check (274)
5
2012-10-10
2008-01-30
Barrie Treloar
No

It is often the case that something that needs equals() will also be displayed, even to the console, and that toString() needs to be better than the default Object.toString().

This check enforces toString() to be defined if equals() is defined.

It is based from the EqualsHashCodeCheck.

I have provided a patch from CheckStyle 4.3 and included unit tests and updates to messages.properties.

I've also tried to update the other languages but I can't guarantee that copy-and-paste is doing what I expect it to in UTF-8 format.

Discussion

  • Barrie Treloar
    Barrie Treloar
    2008-01-30

    Logged In: YES
    user_id=184137
    Originator: YES

    Looking at the patch the UTF-8 files are junk, so I have removed them.

    File Added: checkstyle-patch-1882332.txt

     
  • Barrie Treloar
    Barrie Treloar
    2008-01-30

    Logged In: YES
    user_id=184137
    Originator: YES

    resubmitting patch as I was missing the test class.

    File Added: checkstyle-patch-1882332.txt