Kaydet (Commit) 610f3388 authored tarafından Noel Grandin's avatar Noel Grandin

java: no need to check for null before calling instanceof

the instanceof check returns false when passed a null value

Change-Id: I7742d0d9cf25ef23d9adee7328f701c7efeea8b5
üst 831051f5
......@@ -1603,7 +1603,7 @@ class util
static boolean isVoidAny(Object obj)
{
boolean ret= false;
if( obj != null && obj instanceof Any)
if(obj instanceof Any)
{
Any a= (Any) obj;
if( a.getType().getTypeClass().equals( TypeClass.INTERFACE)
......
......@@ -323,7 +323,7 @@ public class JavaLoader implements XImplementationLoader,
try {
if (null != compfac_method) {
Object ret = compfac_method.invoke( clazz, new Object [] { implementationName } );
if (null == ret || !(ret instanceof XSingleComponentFactory))
if (!(ret instanceof XSingleComponentFactory))
throw new CannotActivateFactoryException(
"No factory object for " + implementationName );
......
......@@ -71,7 +71,7 @@ public class Parameters implements XPropertySet {
public String get(String paramName) {
Object res = parameters.get(paramName);
if (res != null && res instanceof String)
if (res instanceof String)
return (String)res;
if (defaults != null)
......
......@@ -61,7 +61,7 @@ public class SysUtils {
for (int i = 0; i < dfs.length; i++) {
if (dfs[i].MimeType.startsWith("text/plain")) {
Object data = xTrans.getTransferData(dfs[i]);
if (data != null && data instanceof String) {
if (data instanceof String) {
return (String) data;
}
}
......
......@@ -95,7 +95,7 @@ public class _XCellRangesQuery extends MultiMethodTest {
// and the environment has to be disposed: this is necessary for objects
// that do not make entries on the sheet themselves
Object o = tEnv.getObjRelation("XCellRangesQuery.CREATEENTRIES");
if (o != null && o instanceof Boolean) {
if (o instanceof Boolean) {
bMakeEntriesAndDispose = ((Boolean)o).booleanValue();
}
if(bMakeEntriesAndDispose) {
......
......@@ -52,7 +52,7 @@ public class AccessibilityTreeModelBase
Object aChild = null;
try
{
if (aParent != null && aParent instanceof AccessibleTreeNode)
if (aParent instanceof AccessibleTreeNode)
aChild = ((AccessibleTreeNode)aParent).getChild(nIndex);
else
System.out.println ("getChild called for unknown parent node");
......@@ -69,7 +69,7 @@ public class AccessibilityTreeModelBase
Object aChild = null;
try
{
if (aParent != null && aParent instanceof AccessibleTreeNode)
if (aParent instanceof AccessibleTreeNode)
aChild = ((AccessibleTreeNode)aParent).getChildNoCreate(nIndex);
else
System.out.println ("getChild called for unknown parent node");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment