Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: added exception for null return values

...

Given the comparatively rare occurrence of in-band error indicators in Java, it may be possible to compile a list of all methods that use them and automatically detect their use. However, detecting the safe use of in-band error indicators is not feasible in full generality.

Returning an object that might be null on failure or a valid object on success is a common example of in-band error indicator. While there are often better function designs available, returning an object that may be null can be acceptable under some circumstances. See MET54-JG. Always provide feedback about the resulting value of a method for an example.

Bibliography

...