svn commit: r1851701 - in /ofbiz/ofbiz-framework/trunk/framework: base/src/main/java/org/apache/ofbiz/base/conversion/ base/src/main/java/org/apache/ofbiz/base/util/ entity/src/main/java/org/apache/ofbiz/entity/ minilang/src/main/java/org/apache/ofbiz/...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1851701 - in /ofbiz/ofbiz-framework/trunk/framework: base/src/main/java/org/apache/ofbiz/base/conversion/ base/src/main/java/org/apache/ofbiz/base/util/ entity/src/main/java/org/apache/ofbiz/entity/ minilang/src/main/java/org/apache/ofbiz/...

jleroux@apache.org
Author: jleroux
Date: Sun Jan 20 09:39:30 2019
New Revision: 1851701

URL: http://svn.apache.org/viewvc?rev=1851701&view=rev
Log:
Improved: ‘ObjectType’ contains unneeded code
(OFBIZ-10771)

The ObjectType class contains utilities that extends the Java reflection API by
defining methods which accepts string representation of Java types and classes.
It appears that this class contains unneeded code which is either dead or is
redundant with the services already defined in the reflection API

Removes the useless isOrSubOf, instanceOf and interfaceOf methods.
Additionally it removes the getInstance method which is not used anywhere in
the framework or in the plugins.

Also includes similar changes in
AbstractConverter.java
Converters.java
DateTimeConverters.java
GenericEntity.java
IfInstanceOf.java

Thanks: Mathieu

Modified:
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/AbstractConverter.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converters.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/DateTimeConverters.java
    ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java
    ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java
    ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/ifops/IfInstanceOf.java

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/AbstractConverter.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/AbstractConverter.java?rev=1851701&r1=1851700&r2=1851701&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/AbstractConverter.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/AbstractConverter.java Sun Jan 20 09:39:30 2019
@@ -18,8 +18,6 @@
  *******************************************************************************/
 package org.apache.ofbiz.base.conversion;
 
-import org.apache.ofbiz.base.util.ObjectType;
-
 /** Abstract Converter class. This class handles converter registration
  * and it implements the <code>canConvert</code>, <code>getSourceClass</code>,
  * and <code>getTargetClass</code> methods.
@@ -42,7 +40,7 @@ public abstract class AbstractConverter<
     }
 
     public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
-        return ObjectType.instanceOf(sourceClass, this.getSourceClass()) && ObjectType.instanceOf(targetClass, this.getTargetClass());
+        return getSourceClass().isAssignableFrom(sourceClass) && getTargetClass().isAssignableFrom(targetClass);
     }
 
     public Class<? super S> getSourceClass() {

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converters.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converters.java?rev=1851701&r1=1851700&r2=1851701&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converters.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converters.java Sun Jan 20 09:39:30 2019
@@ -27,7 +27,6 @@ import java.util.concurrent.ConcurrentHa
 
 import org.apache.ofbiz.base.lang.SourceMonitored;
 import org.apache.ofbiz.base.util.Debug;
-import org.apache.ofbiz.base.util.ObjectType;
 import org.apache.ofbiz.base.util.UtilGenerics;
 
 /** A <code>Converter</code> factory and repository. */
@@ -203,7 +202,7 @@ OUTER:
         }
 
         public <S, T> Converter<S, T> createConverter(Class<S> sourceClass, Class<T> targetClass) {
-            if (ObjectType.instanceOf(sourceClass, targetClass)) {
+            if (targetClass.isAssignableFrom(sourceClass)) {
                 return new PassThruConverter<>(sourceClass, targetClass);
             }
             return null;

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/DateTimeConverters.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/DateTimeConverters.java?rev=1851701&r1=1851700&r2=1851701&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/DateTimeConverters.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/conversion/DateTimeConverters.java Sun Jan 20 09:39:30 2019
@@ -26,7 +26,6 @@ import java.util.Date;
 import java.util.Locale;
 import java.util.TimeZone;
 
-import org.apache.ofbiz.base.util.ObjectType;
 import org.apache.ofbiz.base.util.TimeDuration;
 import org.apache.ofbiz.base.util.UtilDateTime;
 import org.apache.ofbiz.base.util.UtilValidate;
@@ -42,7 +41,7 @@ public class DateTimeConverters implemen
 
         @Override
         public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
-            return ObjectType.instanceOf(sourceClass, this.getSourceClass()) && targetClass == this.getTargetClass();
+            return getSourceClass().isAssignableFrom(sourceClass) && targetClass == getTargetClass();
         }
 
         public Date convert(Calendar obj) throws ConversionException {
@@ -80,7 +79,7 @@ public class DateTimeConverters implemen
 
         @Override
         public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
-            return ObjectType.instanceOf(sourceClass, this.getSourceClass()) && targetClass == this.getTargetClass();
+            return getSourceClass().isAssignableFrom(sourceClass) && targetClass == getTargetClass();
         }
 
         public Timestamp convert(Calendar obj) throws ConversionException {
@@ -170,7 +169,7 @@ public class DateTimeConverters implemen
 
         @Override
         public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
-            return ObjectType.instanceOf(sourceClass, this.getSourceClass()) && targetClass == this.getTargetClass();
+            return getSourceClass().isAssignableFrom(sourceClass) && targetClass == getTargetClass();
         }
 
         public java.sql.Timestamp convert(java.util.Date obj) throws ConversionException {
@@ -279,7 +278,7 @@ public class DateTimeConverters implemen
 
         @Override
         public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
-            return ObjectType.instanceOf(sourceClass, this.getSourceClass()) && targetClass == this.getTargetClass();
+            return getSourceClass().isAssignableFrom(sourceClass) && targetClass == getTargetClass();
         }
 
         public java.util.Date convert(Number obj) throws ConversionException {
@@ -304,7 +303,7 @@ public class DateTimeConverters implemen
 
         @Override
         public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
-            return ObjectType.instanceOf(sourceClass, this.getSourceClass()) && targetClass == this.getTargetClass();
+            return getSourceClass().isAssignableFrom(sourceClass) && targetClass == getTargetClass();
         }
 
         public java.sql.Date convert(Number obj) throws ConversionException {
@@ -323,7 +322,7 @@ public class DateTimeConverters implemen
 
         @Override
         public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
-            return ObjectType.instanceOf(sourceClass, this.getSourceClass()) && targetClass == this.getTargetClass();
+            return getSourceClass().isAssignableFrom(sourceClass) && targetClass == getTargetClass();
         }
 
         public java.sql.Time convert(Number obj) throws ConversionException {
@@ -338,7 +337,7 @@ public class DateTimeConverters implemen
 
         @Override
         public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
-            return ObjectType.instanceOf(sourceClass, this.getSourceClass()) && targetClass == this.getTargetClass();
+            return getSourceClass().isAssignableFrom(sourceClass) && targetClass == getTargetClass();
         }
 
         public java.sql.Timestamp convert(Number obj) throws ConversionException {
@@ -560,7 +559,7 @@ public class DateTimeConverters implemen
 
         @Override
         public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
-            return ObjectType.instanceOf(sourceClass, this.getSourceClass()) && targetClass == this.getTargetClass();
+            return getSourceClass().isAssignableFrom(sourceClass) && targetClass == getTargetClass();
         }
 
         public java.sql.Date convert(String obj, Locale locale, TimeZone timeZone, String formatString) throws ConversionException {
@@ -593,7 +592,7 @@ public class DateTimeConverters implemen
 
         @Override
         public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
-            return ObjectType.instanceOf(sourceClass, this.getSourceClass()) && targetClass == this.getTargetClass();
+            return getSourceClass().isAssignableFrom(sourceClass) && targetClass == getTargetClass();
         }
 
         public java.sql.Time convert(String obj, Locale locale, TimeZone timeZone, String formatString) throws ConversionException {
@@ -622,7 +621,7 @@ public class DateTimeConverters implemen
 
         @Override
         public boolean canConvert(Class<?> sourceClass, Class<?> targetClass) {
-            return ObjectType.instanceOf(sourceClass, this.getSourceClass()) && targetClass == this.getTargetClass();
+            return getSourceClass().isAssignableFrom(sourceClass) && targetClass == getTargetClass();
         }
 
         public java.sql.Timestamp convert(String obj, Locale locale, TimeZone timeZone, String formatString) throws ConversionException {

Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java?rev=1851701&r1=1851700&r2=1851701&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java Sun Jan 20 09:39:30 2019
@@ -19,8 +19,6 @@
 package org.apache.ofbiz.base.util;
 
 import java.io.Serializable;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -169,203 +167,6 @@ public class ObjectType {
     }
 
     /**
-     * Tests if a class properly implements the specified interface.
-     * @param objectClass Class to test
-     * @param interfaceName Name of the interface to test against
-     * @return true if interfaceName is an interface of objectClass
-     * @throws ClassNotFoundException
-     */
-    public static boolean interfaceOf(Class<?> objectClass, String interfaceName) throws ClassNotFoundException {
-        Class<?> interfaceClass = loadClass(interfaceName);
-
-        return interfaceOf(objectClass, interfaceClass);
-    }
-
-    /**
-     * Tests if a class properly implements the specified interface.
-     * @param objectClass Class to test
-     * @param interfaceObject to test against
-     * @return true if interfaceObject is an interface of the objectClass
-     */
-    public static boolean interfaceOf(Class<?> objectClass, Object interfaceObject) {
-        Class<?> interfaceClass = interfaceObject.getClass();
-
-        return interfaceOf(objectClass, interfaceClass);
-    }
-
-    /**
-     * Returns an instance of the specified class using the constructor matching the specified parameters.
-     * @param className Name of the class to instantiate
-     * @param parameters Parameters passed to the constructor
-     * @return An instance of the className
-     * @throws ClassNotFoundException
-     * @throws InstantiationException
-     * @throws IllegalAccessException
-     */
-    public static Object getInstance(String className, Object[] parameters) throws ClassNotFoundException,
-            InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
-        Class<?>[] sig = new Class<?>[parameters.length];
-        for (int i = 0; i < sig.length; i++) {
-            sig[i] = parameters[i].getClass();
-        }
-        Class<?> c = loadClass(className);
-        Constructor<?> con = c.getConstructor(sig);
-        Object o = con.newInstance(parameters);
-
-        if (Debug.verboseOn()) {
-            Debug.logVerbose("Instantiated object: " + o.toString(), module);
-        }
-        return o;
-    }
-
-    /**
-     * Tests if an object properly implements the specified interface.
-     * @param obj Object to test
-     * @param interfaceName Name of the interface to test against
-     * @return true if interfaceName is an interface of obj
-     * @throws ClassNotFoundException
-     */
-    public static boolean interfaceOf(Object obj, String interfaceName) throws ClassNotFoundException {
-        Class<?> interfaceClass = loadClass(interfaceName);
-
-        return interfaceOf(obj, interfaceClass);
-    }
-
-    /**
-     * Tests if an object properly implements the specified interface.
-     * @param obj Object to test
-     * @param interfaceObject to test against
-     * @return true if interfaceObject is an interface of obj
-     */
-    public static boolean interfaceOf(Object obj, Object interfaceObject) {
-        Class<?> interfaceClass = interfaceObject.getClass();
-
-        return interfaceOf(obj, interfaceClass);
-    }
-
-    /**
-     * Tests if an object properly implements the specified interface.
-     * @param obj Object to test
-     * @param interfaceClass Class to test against
-     * @return true if interfaceClass is an interface of obj
-     */
-    public static boolean interfaceOf(Object obj, Class<?> interfaceClass) {
-        Class<?> objectClass = obj.getClass();
-
-        return interfaceOf(objectClass, interfaceClass);
-    }
-
-    /**
-     * Tests if a class properly implements the specified interface.
-     * @param objectClass Class to test
-     * @param interfaceClass Class to test against
-     * @return true if interfaceClass is an interface of objectClass
-     */
-    public static boolean interfaceOf(Class<?> objectClass, Class<?> interfaceClass) {
-        while (objectClass != null) {
-            Class<?>[] ifaces = objectClass.getInterfaces();
-
-            for (Class<?> iface: ifaces) {
-                if (iface == interfaceClass) {
-                    return true;
-                }
-            }
-            objectClass = objectClass.getSuperclass();
-        }
-        return false;
-    }
-
-    /**
-     * Tests if a class is a class of or a sub-class of the parent.
-     * @param objectClass Class to test
-     * @param parentName Name of the parent class to test against
-     * @return true if objectClass is a class of or a sub-class of the parent
-     * @throws ClassNotFoundException
-     */
-    public static boolean isOrSubOf(Class<?> objectClass, String parentName) throws ClassNotFoundException {
-        Class<?> parentClass = loadClass(parentName);
-
-        return isOrSubOf(objectClass, parentClass);
-    }
-
-    /**
-     * Tests if a class is a class of or a sub-class of the parent.
-     * @param objectClass Class to test
-     * @param parentObject Object to test against
-     * @return true if objectClass is a class of or a sub-class of the parent
-     */
-    public static boolean isOrSubOf(Class<?> objectClass, Object parentObject) {
-        Class<?> parentClass = parentObject.getClass();
-
-        return isOrSubOf(objectClass, parentClass);
-    }
-
-    /**
-     * Tests if an object is an instance of or a sub-class of the parent.
-     * @param obj Object to test
-     * @param parentName Name of the parent class to test against
-     * @return true if obj is an instance of or a sub-class of the parent
-     * @throws ClassNotFoundException
-     */
-    public static boolean isOrSubOf(Object obj, String parentName) throws ClassNotFoundException {
-        Class<?> parentClass = loadClass(parentName);
-
-        return isOrSubOf(obj, parentClass);
-    }
-
-    /**
-     * Tests if an object is an instance of or a sub-class of the parent.
-     * @param obj Object to test
-     * @param parentObject Object to test against
-     * @return true if obj is an instance of or a sub-class of the parent
-     */
-    public static boolean isOrSubOf(Object obj, Object parentObject) {
-        Class<?> parentClass = parentObject.getClass();
-
-        return isOrSubOf(obj, parentClass);
-    }
-
-    /**
-     * Tests if an object is an instance of or a sub-class of the parent.
-     * @param obj Object to test
-     * @param parentClass Class to test against
-     * @return true if obj is an instance of or a sub-class of the parent
-     */
-    public static boolean isOrSubOf(Object obj, Class<?> parentClass) {
-        Class<?> objectClass = obj.getClass();
-
-        return isOrSubOf(objectClass, parentClass);
-    }
-
-    /**
-     * Tests if a class is a class of or a sub-class of the parent.
-     * @param objectClass Class to test
-     * @param parentClass Class to test against
-     * @return true if objectClass is a class of or a sub-class of the parent
-     */
-    public static boolean isOrSubOf(Class<?> objectClass, Class<?> parentClass) {
-        while (objectClass != null) {
-            if (objectClass == parentClass) {
-                return true;
-            }
-            objectClass = objectClass.getSuperclass();
-        }
-        return false;
-    }
-
-    /**
-     * Tests if a class is a class of a sub-class of or properly implements an interface.
-     * @param objectClass Class to test
-     * @param typeObject Object to test against
-     * @return true if objectClass is a class of a sub-class of, or properly implements an interface
-     */
-    public static boolean instanceOf(Class<?> objectClass, Object typeObject) {
-        Class<?> typeClass = typeObject.getClass();
-
-        return instanceOf(objectClass, typeClass);
-    }
-
-    /**
      * Tests if a class is a class of a sub-class of or properly implements an interface.
      * @param objectClass Class to test
      * @param typeName name to test against
@@ -378,18 +179,6 @@ public class ObjectType {
     /**
      * Tests if an object is an instance of a sub-class of or properly implements an interface.
      * @param obj Object to test
-     * @param typeObject Object to test against
-     * @return true if obj is an instance of a sub-class of, or properly implements an interface
-     */
-    public static boolean instanceOf(Object obj, Object typeObject) {
-        Class<?> typeClass = typeObject.getClass();
-
-        return instanceOf(obj, typeClass);
-    }
-
-    /**
-     * Tests if an object is an instance of a sub-class of or properly implements an interface.
-     * @param obj Object to test
      * @param typeName name to test against
      * @return true if obj is an instance of a sub-class of, or properly implements an interface
      */
@@ -411,7 +200,7 @@ public class ObjectType {
             throw new IllegalArgumentException("Illegal type found in info map (could not load class for specified type)");
         }
 
-        return instanceOf(objectClass, infoClass);
+        return infoClass.isAssignableFrom(objectClass);
     }
 
     /**
@@ -428,7 +217,7 @@ public class ObjectType {
             throw new IllegalArgumentException("Illegal type found in info map (could not load class for specified type)");
         }
 
-        return instanceOf(obj, infoClass);
+        return obj == null || infoClass.isInstance(obj);
     }
 
     public static Class<?> loadInfoClass(String typeName, ClassLoader loader) {
@@ -458,33 +247,6 @@ public class ObjectType {
         }
     }
 
-    /**
-     * Tests if an object is an instance of a sub-class of or properly implements an interface.
-     * @param obj Object to test
-     * @param typeClass Class to test against
-     * @return true if obj is an instance of a sub-class of typeClass
-     */
-    public static boolean instanceOf(Object obj, Class<?> typeClass) {
-        if (obj == null) {
-            return true;
-        }
-        Class<?> objectClass = obj.getClass();
-        return instanceOf(objectClass, typeClass);
-    }
-
-    /**
-     * Tests if a class is a class of a sub-class of or properly implements an interface.
-     * @param objectClass Class to test
-     * @param typeClass Class to test against
-     * @return true if objectClass is a class or sub-class of, or implements typeClass
-     */
-    public static boolean instanceOf(Class<?> objectClass, Class<?> typeClass) {
-        if (typeClass.isInterface() && !objectClass.isInterface()) {
-            return interfaceOf(objectClass, typeClass);
-        }
-        return isOrSubOf(objectClass, typeClass);
-    }
-
     /** See also {@link #simpleTypeOrObjectConvert(Object obj, String type, String format, TimeZone timeZone, Locale locale, boolean noTypeFail)}. */
     public static Object simpleTypeOrObjectConvert(Object obj, String type, String format, Locale locale, boolean noTypeFail) throws GeneralException {
         return simpleTypeOrObjectConvert(obj, type, format, null, locale, noTypeFail);

Modified: ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java?rev=1851701&r1=1851700&r2=1851701&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/GenericEntity.java Sun Jan 20 09:39:30 2019
@@ -493,7 +493,7 @@ public class GenericEntity implements Ma
                     value = ((String) value).getBytes(UtilIO.getUtf8());
                 }
                 if (!ObjectType.instanceOf(value, type.getJavaType())) {
-                    if (!("java.sql.Blob".equals(type.getJavaType()) && (value instanceof byte[] || ObjectType.instanceOf(value, ByteBuffer.class)))) {
+                    if (!("java.sql.Blob".equals(type.getJavaType()) && (value instanceof byte[] || value == null || ByteBuffer.class.isInstance(value)))) {
                         String errMsg = "In entity field [" + this.getEntityName() + "." + name + "] set the value passed in [" + value.getClass().getName() + "] is not compatible with the Java type of the field [" + type.getJavaType() + "]";
                         // eventually we should do this, but for now we'll do a "soft" failure: throw new IllegalArgumentException(errMsg);
                         Debug.logWarning(new Exception("Location of database type warning"), "=-=-=-=-=-=-=-=-= Database type warning GenericEntity.set =-=-=-=-=-=-=-=-= " + errMsg, module);

Modified: ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/ifops/IfInstanceOf.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/ifops/IfInstanceOf.java?rev=1851701&r1=1851700&r2=1851701&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/ifops/IfInstanceOf.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/ifops/IfInstanceOf.java Sun Jan 20 09:39:30 2019
@@ -82,7 +82,7 @@ public final class IfInstanceOf extends
         boolean runSubOps = false;
         Object fieldVal = fieldFma.get(methodContext.getEnvMap());
         if (fieldVal != null) {
-            runSubOps = ObjectType.instanceOf(fieldVal.getClass(), compareClass);
+            runSubOps = compareClass.isAssignableFrom(fieldVal.getClass());
         }
         if (runSubOps) {
             return SimpleMethod.runSubOps(subOps, methodContext);