4 comments
Comment actions Permalink


No. The JVM is supposed to magically handle all of the serialization issues of enums. This is somewhat annoyingly inconsistent, but if you weren't up for annoying inconsistency, you would be using Java serialization functionality.

I've fixed the "Serializable without serialVersionUID" and "Serializable without readObject() and writeObject()" inspections to ignore enumerated classes. Good catch.

--Dave Griffith

0
Comment actions Permalink

/s/would/wouldn't

0
Comment actions Permalink

I see in the enum documentation that "All are Serializable, Comparable and effectively final." If I'm reading the documentation right, would a new inspection that says Serializable on a enum is unnecessary/redundant be appropriate?

Thanks,
Jon

0
Comment actions Permalink


There's already an inspection for redundant interface declarations that would catch this case. I run with it off because I like the documentation effect. That said, I agree that defining an enumerated class as Serializable or Comparable would look fairly stupid. I'll think about if the existing inspection can be sharpened, or if a new inspection is appropriate.

--Dave Griffith

0

Please sign in to leave a comment.