Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Methods should always try to return a value that allows the developer to learn about the current state of the object and/or the result of an operation. This advice is consistent with guideline EXP00-J. Do not ignore values returned by methods. The returned value should be as representative as possible of the last known state and should be chosen with the perceptions and mental model of the developer in mind.

...

[Ware 2008]
[MITRE 2009] CWE ID 393, "Return of Wrong Status Code," and CWE ID 389, "Error Conditions, Return Values, Status Codes"

...

MET52-JJG. Do not use the clone method to copy untrusted method parameters      05. Methods (MET)      MET54-J. For methods that return an array or collection prefer returning an empty array or collection over a null value