Relates :
|
|
Relates :
|
|
Relates :
|
Javac issues a [serial] warning if an instantiation of an anonymous inner class is missing a serialVersionUID. For example, return new java.security.Key() { // ... } results in something like Warning.java:16: warning: [serial] serializable class <anonymous Warning$1> has no definition of serialVersionUID There are a variety of reasons that serialization compatibility of an anonymous inner class cannot be guaranteed, or even that such instances can be serialized at all. Thus, it is incorrect to warn the user to add a useless serialVersionUID. (Reasons include: anonymous class names are implementation-specific and may vary from one build to the next; synthesized field names and types may also vary unpredictably; the enclosing instance or captured local variables might not be serializable; even if they were serializable it's unlikely that this is what the programmer would want.)
|