How do generate this value in IntelliJ IDEA?
I go to Settings -> Errors -> Serialization issues -> Serializable class without ‘serialVersionUID’, but it still doesn't show me the warning. My class PKladrBuilding parent implements interface Serializable.
Part of the code:
public class PKladrBuilding extends PRQObject public abstract class PRQObject extends PObject public abstract class PObject implements Serializable
You can generate SerialVersionUID in intellij by pressing ctrl + shift +A (find action) and then typing Serializable class without serialVersionUID and toggle it from Off to On.
File -> Settings -> Editor -> Inspections -> Java -> Serialization issues -> Serializable class without 'serialVersionUID' - set flag and click 'OK'. (For Macs, Settings is under IntelliJ IDEA -> Preferences...)
If class does not contain a serialVersionUID field, its serialVersionUID will be automatically generated by the compiler. Different compilers, or different versions of the same compiler, will generate potentially different values.
for Android developers, you can also enable serialization inspection from Settings -> Editor -> Inspections -> enable "Serializable class without 'serialVersionUID' check" first, then ALT+ ENTER, the studio will create serialVersionUID for you.
I am not sure if you have an old version of IntelliJ IDEA, but if I go to menu File → Settings... → Inspections → Serialization issues → Serializable class without 'serialVersionUID'` enabled, the class you provide give me warnings.
If I try the first class I see:
BTW: It didn't show me a warning until I added { }
to the end of each class to fix the compile error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With