Inspectopedia
 
2024.3

'readObject()' or 'writeObject()' not declared 'private'

Warning
New
Last modified: 03 December 2024

Reports Serializable classes where the readObject or writeObject methods are not declared private. There is no reason these methods should ever have a higher visibility than private.

A quick-fix is suggested to make the corresponding method private.

Example:

After the quick-fix is applied: