When is it desired to not implement toString() in Java?

后端 未结 24 2103
心在旅途
心在旅途 2020-12-10 00:45

A lead developer on my project has taken to referring to the project\'s toString() implementations as \"pure cruft\" and is looking to remove them from the code base.

<
24条回答
  •  天命终不由人
    2020-12-10 00:59

    To be fair, said developer here, but not lead developer in any sense.

    The original issue is not necessarily about toString(), but about a second method paramString: "With all of its string concatenation and null value checking, paramString is a bug magnet."

    See http://code.google.com/p/piccolo2d/issues/detail?id=99

提交回复
热议问题