Remove redundant null checks used with "instanceof"
SonarLint reports: Null checks should not be used with "instanceof" (squid:S4201) There's no need to null test in conjunction with an instanceof test. null is not an instanceof anything, so a null check is redundant. Change-Id: I29506aebfe337c8c300b46179e43b3057d9ae370
This commit is contained in:
@@ -572,7 +572,7 @@ public class ProjectBranchesScreen extends PaginatedProjectScreen {
|
||||
boolean on = false;
|
||||
for (int row = 1; row < table.getRowCount(); row++) {
|
||||
Widget w = table.getWidget(row, 1);
|
||||
if (w != null && w instanceof CheckBox) {
|
||||
if (w instanceof CheckBox) {
|
||||
CheckBox sel = (CheckBox) w;
|
||||
if (sel.getValue()) {
|
||||
on = true;
|
||||
|
@@ -470,7 +470,7 @@ public class ProjectTagsScreen extends PaginatedProjectScreen {
|
||||
boolean on = false;
|
||||
for (int row = 1; row < table.getRowCount(); row++) {
|
||||
Widget w = table.getWidget(row, 1);
|
||||
if (w != null && w instanceof CheckBox) {
|
||||
if (w instanceof CheckBox) {
|
||||
CheckBox sel = (CheckBox) w;
|
||||
if (sel.getValue()) {
|
||||
on = true;
|
||||
|
@@ -163,7 +163,7 @@ public class PluginLoader extends DialogBox {
|
||||
|
||||
Exception e = plugin.failure();
|
||||
String msg;
|
||||
if (e != null && e instanceof CodeDownloadException) {
|
||||
if (e instanceof CodeDownloadException) {
|
||||
msg = Gerrit.M.cannotDownloadPlugin(plugin.url());
|
||||
} else {
|
||||
msg = Gerrit.M.pluginFailed(plugin.name());
|
||||
|
@@ -37,9 +37,7 @@ public class AndChangeSource extends AndSource<ChangeData> implements ChangeData
|
||||
|
||||
@Override
|
||||
public boolean hasChange() {
|
||||
return source != null
|
||||
&& source instanceof ChangeDataSource
|
||||
&& ((ChangeDataSource) source).hasChange();
|
||||
return source instanceof ChangeDataSource && ((ChangeDataSource) source).hasChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user