diff options
author | Ahmed Ashour <asashour@yahoo.com> | 2017-10-12 08:00:02 +0200 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-10-12 09:00:02 +0300 |
commit | 13d406a7086cc1546eac3fa86f6263bfb436de85 (patch) | |
tree | c571de7cc72bdcad1d8473266dbcdd76a2b0487b /compatibility-server | |
parent | d0b5741b81d214491c93d4d042c79e10bb4f192e (diff) | |
download | vaadin-framework-13d406a7086cc1546eac3fa86f6263bfb436de85.tar.gz vaadin-framework-13d406a7086cc1546eac3fa86f6263bfb436de85.zip |
Remove redundant null checks before an instanceof (#10173)
Diffstat (limited to 'compatibility-server')
6 files changed, 8 insertions, 9 deletions
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/FilesystemContainer.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/FilesystemContainer.java index 4ae90a7569..edb46ae4e5 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/FilesystemContainer.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/FilesystemContainer.java @@ -676,7 +676,7 @@ public class FilesystemContainer implements Container.Hierarchical { */ @Override public boolean equals(Object obj) { - if (obj == null || !(obj instanceof FileItem)) { + if (!(obj instanceof FileItem)) { return false; } final FileItem fi = (FileItem) obj; diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/PropertysetItem.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/PropertysetItem.java index d7be9c54e8..a486ec2443 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/PropertysetItem.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/PropertysetItem.java @@ -325,7 +325,7 @@ public class PropertysetItem @Override public boolean equals(Object obj) { - if (obj == null || !(obj instanceof PropertysetItem)) { + if (!(obj instanceof PropertysetItem)) { return false; } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/RowItem.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/RowItem.java index 78ef1f8d58..425a5c1f60 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/RowItem.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/sqlcontainer/RowItem.java @@ -65,7 +65,7 @@ public final class RowItem implements Item { @Override public Property getItemProperty(Object id) { - if (id instanceof String && id != null) { + if (id instanceof String) { for (ColumnProperty cp : properties) { if (id.equals(cp.getPropertyId())) { return cp; diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/validator/DoubleValidator.java b/compatibility-server/src/main/java/com/vaadin/v7/data/validator/DoubleValidator.java index ef8dde86f4..c549c18738 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/validator/DoubleValidator.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/validator/DoubleValidator.java @@ -59,7 +59,7 @@ public class DoubleValidator extends AbstractStringValidator { @Override public void validate(Object value) throws InvalidValueException { - if (value != null && value instanceof Double) { + if (value instanceof Double) { // Allow Doubles to pass through the validator for easier // migration. Otherwise a TextField connected to an double property // with a DoubleValidator will fail. diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/validator/IntegerValidator.java b/compatibility-server/src/main/java/com/vaadin/v7/data/validator/IntegerValidator.java index a65c7884f2..f5a004215e 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/validator/IntegerValidator.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/validator/IntegerValidator.java @@ -60,7 +60,7 @@ public class IntegerValidator extends AbstractStringValidator { @Override public void validate(Object value) throws InvalidValueException { - if (value != null && value instanceof Integer) { + if (value instanceof Integer) { // Allow Integers to pass through the validator for easier // migration. Otherwise a TextField connected to an integer property // with an IntegerValidator will fail. diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java index f23326e4f3..45b16f0381 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java @@ -1939,8 +1939,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements if (pids != null) { for (Object id : pids) { Property<?> p = i.getItemProperty(id); - if (p != null - && p instanceof Property.ValueChangeNotifier) { + if (p instanceof Property.ValueChangeNotifier) { ((Property.ValueChangeNotifier) p) .addValueChangeListener( getCaptionChangeListener()); @@ -1953,7 +1952,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements case PROPERTY: final Property<?> p = getContainerProperty(itemId, getItemCaptionPropertyId()); - if (p != null && p instanceof Property.ValueChangeNotifier) { + if (p instanceof Property.ValueChangeNotifier) { ((Property.ValueChangeNotifier) p) .addValueChangeListener(getCaptionChangeListener()); captionChangeNotifiers.add(p); @@ -1964,7 +1963,7 @@ public abstract class AbstractSelect extends AbstractField<Object> implements if (getItemIconPropertyId() != null) { final Property p = getContainerProperty(itemId, getItemIconPropertyId()); - if (p != null && p instanceof Property.ValueChangeNotifier) { + if (p instanceof Property.ValueChangeNotifier) { ((Property.ValueChangeNotifier) p) .addValueChangeListener(getCaptionChangeListener()); captionChangeNotifiers.add(p); |