Hi Sebb,
 I also noticed that but I think that making the container Serializable is
not useful neither wanted though I agree that it should be documented or
maybe refactored i.e. extracting the Serializable class in a
LRULinkedHashMap class extending LinkedHashMap wiith the specified method
and constructor.
Cheers,
Tommaso

2010/1/27 sebb <seb...@gmail.com>

> 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