When you are creating java files, It generates serialVersionUID if the class implements a Serializable interface by the compiler in Eclipse. Eclipse throws a warning if serialVersionUID declaration is not found.

IntelliJ IDEA does not throw warnings by default for this.

How to throw a warning if serialVersionUID warning in IntelliJ IDEA.

Intellij IDEA generate serialVersionUID warning

There are multiple ways we can do it.

Using settings

  • File > Settings, It opens the settings window
  • Editor > Inspections >Serialization issues Panel
  • Check Serializable class without ‘serialVersionUID’, It reports a warning when a class implements a Serializable interface.
  • Click APPLY and OK to close the current window

Using Find Action

  • Open Intelli IDEA
  • Select the text you want to select or Ctrl + A to the selected complete file.
  • Select the Help Menu + Find Actions or use the below shortcut commands.
    • Windows: hotkeys: Ctrl + Shift + A
    • Mac: shortcuts: ⌘ + Shift + A

Type Serializable class without 'serialVersionUID' in the search box and select the below option. Serialization Issues: Serializable class without 'serialVersionUID' to true.

  • In the java class, it throws a warning if the serialVersionUID declaration is missing.