Java code quality notes from the trenches.11 Jan 2017
Whether you are a newbie or an old hat Java programmer, you can save yourself some embarrassment by avoiding the below most common programming errors.
- Not serializing objects (and nested objects within) that are stored in HttpSession.
- See Effective Java Second Edition (EJ2), Item 74
- Throwing generic exception instead of application specific exception.
- See EJ2, Item 61
- Ignoring or swallowing a thrown Exception while re-throwing.
- See EJ2, Item 63, 65
- Not overriding hashcode() when equals() is overridden.
- See EJ2, Item 9
- Mutating static member via an instance member.
- See EJ2, Item 15 and Item 66
All of these will be caught by any good code quality scanner. Please use one.