Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2021-01-30 14:27:33 +0000
committerNiraj Modi2021-02-10 08:03:01 +0000
commit7dfe642b7ada1ca337b2dbe4e5e2d7a3d509a795 (patch)
treee928033d86bcfbd73ddd7ebfc4333d1a8a86b5c2
parentdc3185fd5e06b83e038c2dfef5f11538d4c20c72 (diff)
downloadeclipse.platform.swt-7dfe642b7ada1ca337b2dbe4e5e2d7a3d509a795.tar.gz
eclipse.platform.swt-7dfe642b7ada1ca337b2dbe4e5e2d7a3d509a795.tar.xz
eclipse.platform.swt-7dfe642b7ada1ca337b2dbe4e5e2d7a3d509a795.zip
[Cleanup] Evaluate 'instanceof' without a null check
Change-Id: I195f6f89e426b77ad3d68333dfc305fa28336ffa Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBannerLayout.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashFormLayout.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ViewFormLayout.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/HTMLTransfer.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java2
11 files changed, 12 insertions, 12 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
index 6458df2494..f56d398f46 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Accessibility/win32/org/eclipse/swt/accessibility/Accessible.java
@@ -2305,7 +2305,7 @@ public class Accessible {
hItem = OS.SendMessage (hwnd, OS.TVM_MAPACCIDTOHTREEITEM, v.lVal, 0);
Widget widget = tree.getDisplay ().findWidget (hwnd, hItem);
event.result = "";
- if (widget != null && widget instanceof TreeItem) {
+ if (widget instanceof TreeItem) {
TreeItem item = (TreeItem) widget;
for (int i = 1; i < columnCount; i++) {
if (tree.isDisposed() || item.isDisposed()) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBannerLayout.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBannerLayout.java
index 292f2181a9..2e69b67f87 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBannerLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBannerLayout.java
@@ -107,7 +107,7 @@ int computeTrim(Control c) {
@Override
protected boolean flushCache(Control control) {
Object data = control.getLayoutData();
- if (data != null && data instanceof CLayoutData) ((CLayoutData)data).flushCache();
+ if (data instanceof CLayoutData) ((CLayoutData)data).flushCache();
return true;
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java
index ac5cd11cd5..23a9874a20 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashForm.java
@@ -179,7 +179,7 @@ public int[] getWeights() {
int[] ratios = new int[cArray.length];
for (int i = 0; i < cArray.length; i++) {
Object data = cArray[i].getLayoutData();
- if (data != null && data instanceof SashFormData) {
+ if (data instanceof SashFormData) {
ratios[i] = (int)(((SashFormData)data).weight * 1000 >> 16);
} else {
ratios[i] = 200;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashFormLayout.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashFormLayout.java
index 0df0dc5313..8c17111d48 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashFormLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/SashFormLayout.java
@@ -60,7 +60,7 @@ protected Point computeSize(Composite composite, int wHint, int hHint, boolean f
long total = 0;
for (int i = 0; i < cArray.length; i++) {
Object data = cArray[i].getLayoutData();
- if (data != null && data instanceof SashFormData) {
+ if (data instanceof SashFormData) {
ratios[i] = ((SashFormData)data).weight;
} else {
data = new SashFormData();
@@ -144,7 +144,7 @@ protected void layout(Composite composite, boolean flushCache) {
long total = 0;
for (int i = 0; i < controls.length; i++) {
Object data = controls[i].getLayoutData();
- if (data != null && data instanceof SashFormData) {
+ if (data instanceof SashFormData) {
ratios[i] = ((SashFormData)data).weight;
} else {
data = new SashFormData();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ViewFormLayout.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ViewFormLayout.java
index c9245b49b2..6ae35e4b42 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ViewFormLayout.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/ViewFormLayout.java
@@ -104,7 +104,7 @@ int computeTrim(Control c) {
@Override
protected boolean flushCache(Control control) {
Object data = control.getLayoutData();
- if (data != null && data instanceof CLayoutData) ((CLayoutData)data).flushCache();
+ if (data instanceof CLayoutData) ((CLayoutData)data).flushCache();
return true;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java
index c2b2553800..4a94ddf79f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/ByteArrayTransfer.java
@@ -213,6 +213,6 @@ protected Object nativeToJava(TransferData transferData) {
}
boolean checkByteArray(Object object) {
- return (object != null && object instanceof byte[] && ((byte[])object).length > 0);
+ return (object instanceof byte[] && ((byte[])object).length > 0);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/HTMLTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/HTMLTransfer.java
index 1be51dba99..c6baa3b2b8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/HTMLTransfer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/HTMLTransfer.java
@@ -210,7 +210,7 @@ protected String[] getTypeNames(){
return new String[] {HTML_FORMAT};
}
boolean checkHTML(Object object) {
- return (object != null && object instanceof String && ((String)object).length() > 0);
+ return (object instanceof String && ((String)object).length() > 0);
}
@Override
protected boolean validate(Object object) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java
index ab1fbb1f8d..0cff2626dd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/RTFTransfer.java
@@ -135,7 +135,7 @@ protected String[] getTypeNames(){
}
boolean checkRTF(Object object) {
- return (object != null && object instanceof String && ((String)object).length() > 0);
+ return (object instanceof String && ((String)object).length() > 0);
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java
index c9c233ecee..25ee927b3a 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Drag and Drop/win32/org/eclipse/swt/dnd/TextTransfer.java
@@ -188,7 +188,7 @@ protected String[] getTypeNames(){
}
boolean checkText(Object object) {
- return (object != null && object instanceof String && ((String)object).length() > 0);
+ return (object instanceof String && ((String)object).length() > 0);
}
@Override
diff --git a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java
index cf172b5349..6456cb5ae1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT OLE Win32/win32/org/eclipse/swt/ole/win32/OleFrame.java
@@ -207,7 +207,7 @@ static long getMsgProc(long code, long wParam, long lParam) {
if (widget != null) break;
hwnd = OS.GetParent (hwnd);
}
- if (widget != null && widget instanceof OleClientSite) {
+ if (widget instanceof OleClientSite) {
OleClientSite site = (OleClientSite)widget;
if (site.handle == hwnd) {
boolean consumed = false;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
index 708d562bb9..621556f529 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Display.java
@@ -2262,7 +2262,7 @@ public Shell [] getShells () {
int index = 0;
Shell [] result = new Shell [16];
for (Control control : controlTable) {
- if (control != null && control instanceof Shell) {
+ if (control instanceof Shell) {
int j = 0;
while (j < index) {
if (result [j] == control) break;

Back to the top