Jens Schauder
Jens Schauder

Reputation: 81988

Findbugs Bug SE_BAD_FIELD on boolean field

We have Findbugs configured to run on our Jenkins via Maven.

Among other things it complains about SE_BAD_FIELD on the following code line:

private boolean logged = false;

The description of this bug says

Se: Non-transient non-serializable instance field in serializable class (SE_BAD_FIELD)

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.

But boolean is a primitive!? So why is it complaining? Or is this some kind of Findbugs, Maven or Jenkins Bug?

Upvotes: 1

Views: 2335

Answers (1)

barfuin
barfuin

Reputation: 17494

I have noticed that FindBugs sometimes reports the wrong line number for SE_BAD_FIELD. So you might want to check the other fields for serializability instead. (I use FB 1.3.9.).

Upvotes: 1

Related Questions