songchuanyuan66 / concurrentlinkedhashmap

Automatically exported from code.google.com/p/concurrentlinkedhashmap
Apache License 2.0
0 stars 1 forks source link

FindBugs reports serialization issues #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. ant run-findbugs
2. open the HTML file
3.

What is the expected output? What do you see instead?

Please use labels and text to provide additional information.

May need to re-think whether it is useful to make the map serializable.

Se  Class ConcurrentLinkedHashMap defines non-transient non-serializable
instance field sentinel
Se  Class ConcurrentLinkedHashMap defines non-transient non-serializable
instance field data
Se  Class ConcurrentLinkedHashMap defines non-transient non-serializable
instance field listenerQueue
Se  Class ConcurrentLinkedHashMap defines non-transient non-serializable
instance field reorderQueue
Se  Class ConcurrentLinkedHashMap defines non-transient non-serializable
instance field weigher
Se  Class ConcurrentLinkedHashMap defines non-transient non-serializable
instance field writeQueue
Se  Class ConcurrentLinkedHashMap$SerializationProxy defines non-transient
non-serializable instance field data
Se  Class ConcurrentLinkedHashMap$SerializationProxy defines non-transient
non-serializable instance field weigher
Se  ConcurrentLinkedHashMap$WriteThroughEntry is serializable and an inner
class
SnVI    ConcurrentLinkedHashMap$WriteThroughEntry is Serializable; consider
declaring a serialVersionUID

Se: This Serializable class defines a non-primitive instance field which is
neither transient, Serializable, or java.lang.Object, and does not appear
to implement the Externalizable interface or the readObject() and
writeObject() methods.  Objects of this class will not be deserialized
correctly if a non-Serializable object is stored in this field.

Se inner class: This Serializable class is an inner class. Any attempt to
serialize it will also serialize the associated outer instance. The outer
instance is serializable, so this won't fail, but it might serialize a lot
more data than intended. If possible, making the inner class a static inner
class (also known as a nested class) should solve the problem.

Original issue reported on code.google.com by zells...@gmail.com on 11 Apr 2010 at 10:41

Attachments:

GoogleCodeExporter commented 9 years ago
I think that its not correctly understanding that the proxy is being serialized 
instead. If the client's eviction-listener and weigher are not Serializable, 
then 
they would fail as expected. I'm not sure if sprinkling transient and other 
changes 
would be worth it to resolve the warnings. What would you like to do?

I was originally planning on dropping serialization, but it was requested as a 
cheap 
warm-up cycle so I added it back. I think its worth keeping, though I'd be open 
to 
fine tuning it.

Original comment by Ben.Manes@gmail.com on 12 Apr 2010 at 6:35

GoogleCodeExporter commented 9 years ago
Verified that serialization is correct. FindBugs doesn't understand the 
serialization proxy idiom. I fixed the WriteThroughEntry, though.

Original comment by Ben.Manes@gmail.com on 13 Apr 2010 at 3:27