I have a instance of HashMap<MyClass2,Queue<Point2D>>
in my class. My class implements JPanel
. Findbugs is showing SE_BAD_FIELD for the instance of HashMap
in my class but HashMap
implements Serializable
. I am using findbugs 3.0.0X, and JDK 1.7.0_45.
Se: Non-transient non-serializable instance field in serializable class (SE_BAD_FIELD)
This Serializable class defines a non-primitive instance field which is neither transient, Serializable, or java.lang.Object, and does not appear to implement the Externalizable interface or the readObject() and writeObject() methods. Objects of this class will not be deserialized correctly if a non-Serializable object is stored in this field.
HashMap
should beSerializable
too? – वरुणMyClass2
is notSerializable
.Point2D
is a java class fromjava.awt.geom
package. – वरुण