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".
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With