开发者

Findbugs non-transient non-serializable instance field

While running the code through FindBugs to pick up smelly bits I am getting

Bug: Class com.MyClass defines non-transient non-serializable instance field someSet Pattern id: SE_BAD_FIELD, type: Se, category: BAD_PRACTICE

I know set does not implement serialization but HashSet does and thats why it is being initialized then and there .I thought this was the good practice :( but apparently not

开发者_高级运维
public class Myclass extends 
{ 
   @Transient
   private Set<String> someSet = new HashSet<String>();

        ...........
}

Any help would be great . Low level warning but would love to know why ?


Unfortunately, FindBugs isn't smart enough to recognize that the field that is defined as Set is actually a HashSet. It's a shortcoming of findbugs. You should add an issue here http://sourceforge.net/tracker/?group_id=96405&atid=614693

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜