findbugs 修复日志

1、SIC_INNER_SHOULD_BE_STATIC, Priority: Low
BUG描述:This class is an inner class, but does not use its embedded reference to the object which created it.  This reference makes the instances of the class larger, and may keep the reference to the creator object alive longer than necessary.  If possible, the class should be made static.(若成员类中未访问外围类的非静态成员,为避免额外的空间和时间开销,建议改用静态成员类。)

问题原因:非静态成员类和静态成员类的区别在于,非静态成员类是对象的,静态成员类是类的。非静态成员类可以访问外围类的任何成员,但前提是必须存在外围类对象。JAVA需要额外维护非静态成员类和外围类对象的关系,所以findbugs建议将其设为static型。

2、NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS, Priority: Normal
A possibly-null value is passed at a call site where all known target methods require the parameter to be nonnull. Either the parameter is annotated as a parameter that should always be nonnull, or analysis has shown that it will always be dereferenced.

参数调用一般都不要设置为NULL,这样调用的方法可以能会出现空指针异常

你可能感兴趣的:(java)