3
考慮下面的代碼:未經檢查的鑄造用FindBugs的抱怨
public void broadcast(FacesEvent event)
throws AbortProcessingException {
if(!(event instanceof WrapperEvent)) {
super.broadcast(event);
return;
}
// Sets up the correct context and fire our wrapped event.
GridWrapperEvent revent = (GridWrapperEvent)event; // FindBugs is complaining here
int oldRowIndex = getRowIndex();
int oldColumnIndex = getColumnIndex();
boolean oldClientIdRewritting = clientIdRewritting;
setClientIdRewritting(revent.isClientIdRewritting());
setActiveCell(revent.getRowIndex(), revent.getColumnIndex());
FacesEvent rowEvent = revent.getFacesEvent();
rowEvent.getComponent().broadcast(rowEvent);
setActiveCell(oldRowIndex, oldColumnIndex);
setClientIdRewritting(oldClientIdRewritting);
}
FindBugs抱怨的註釋行。有什麼我可以做的嗎?這是FindBugs的說什麼:
未檢查/未經證實的投 這是投選中,而不是從可轉換爲它正在 投的類型鑄造類型的所有 實例。確保你的程序邏輯確保這個強制轉換 不會失敗。