GenericRenderers icon indicating copy to clipboard operation
GenericRenderers copied to clipboard

SerializableRendererContent is badly structured

Open danielgoncharov opened this issue 9 years ago • 0 comments

The problem with SerializableRendererContent is that it extends non serializable object RendererContent so it will serialize only SerializableRendererContent itself without T item, int type. Moreover useing this class right now is dangerous for serialization since super class does not have default constructor so while being restored it will throw the exception.

Solution: -Make RendererContent serializable -Remove SerializableRendererContent

If class A does not implement Serializable but a subclass B implements Serializable, will the fields of class A be serialized when B is serialized? Only the fields of Serializable objects are written out and restored. The object may be restored only if it has a no-arg constructor that will initialize the fields of non-serializable supertypes. If the subclass has access to the state of the superclass it can implement writeObject and readObject to save and restore that state.[1][2]

[1]http://www.oracle.com/technetwork/java/javase/tech/serializationfaq-jsp-136699.html#serialsuper [2]http://docs.oracle.com/javase/1.5.0/docs/api/java/io/Serializable.html

danielgoncharov avatar Jan 04 '17 08:01 danielgoncharov