Findbugs reports the following error:

>>>
Bug: org.apache.commons.digester.annotations.utils.InMemoryLRUCache$1
is serializable but also an inner class of a non-serializable class
Pattern id: SE_BAD_FIELD_INNER_CLASS, type: Se, category: BAD_PRACTICE

This Serializable class is an inner class of a non-serializable class.
Thus, attempts to serialize it will also attempt to associate instance
of the outer class with which it is associated, leading to a runtime
error.

If possible, making the inner class a static inner class should solve
the problem. Making the outer class serializable might also work, but
that would mean serializing an instance of the inner class would
always also serialize the instance of the outer class, which it often
not what you really want.
<<<

It's not possible to make the inner class static, however it should be
possible to make the container Serializable. I'm not sure if that is
wanted or not.

If not, then I think the only solution is to document the fact that
although the inner class is serializable, this is not intentional.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to