javadoc as well as question both underline
Enum sets are represented internally as bit vectors.
Now I'm wondering - what is the behavior when sending (standard Java serialization) EnumSet objects on wiring to another JVM, which may have a different version of the Enum base class?
In other words: when I posted some Set<MyEnum>, it is possible that an exception is thrown during de-serialization to another JVM (in cases where my JVM uses some MyEnum.NEW_GUYthat the other JVM doesn’t know). In this situation, deserialization attempts to create an enum constant that does not exist in the class on another JVM.
But assuming that EnumSet does not carry constant instances of enum (but only a bit with some bits true, some false) - what happens when a serialized EnumSet turns on MyEnum.NEW_GUY?
I tried to define a specification that tells me what should happen (as opposed to assuming that this is an implementation detail), but so far no luck.
source
share