考虑以下代码:
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 所说的:
未经检查/未经确认 的强制转换 这种强制转换是未经检查的,并且并非所有被转换类型的实例都可以转换为它被转换到的类型。确保您的程序逻辑确保此转换不会失败。