Findbugs SIO_SUPERFLUOUS_INSTANCEOF
||
在我的findbugs报告中,以下代码部分中有SIO_SUPERFLUOUS_INSTANCEOF正确性错误
/** Allow Comparison based on User-Labels */
public int compareTo(AbstractListItem o) {
if ( !( o instanceof AbstractListItem ) ) {
// Correctness - Unnecessary type check done using instanceof operator
// : Method com.x.y.gui.topology.TopologyListNode.compareTo (AbstractListItem)
// does an unnecessary type check using instanceof operator when it
// can be determined statically
return -1;
}
静态确定类型的正确方法是什么?
没有找到相关结果
已邀请:
2 个回复
骚瓤
-
是
,您无需检查。 如果您有
,则需要
,并且不会发出警告。
娠侈脚惮顽