Reputation: 5988
i have a member like this in a serializable class:
private final Map<String, List<T>> categoryMap = Maps.newHashMap();
the class has the following type-bounds.
<T extends Serializable>
I use findbugs to check for mistakes in my code, and it shows me that member as "not (guaranteed to be) serializable".
Upvotes: 3
Views: 1695
Reputation: 240948
Because your serializable class contains the following member
private final Map<String, List<T>> categoryMap
here T
can be any class Foo
, which isn't guaranteed to be Serializable and so the warning/suggestion/eye opener
If you are expecting it to be serializable in all the cases than make it
List<? extends Serializable>
and if you don't want to seralize that field at all simply mark transient
Upvotes: 7