From 94f842fa9223d1d0fa233266495a20a00eafa030 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 4 Mar 2019 21:05:08 +0000 Subject: % Final touches to TC aspects. The 5 custom ones added by GT++ now have names and proper handling. --- src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/Java/gtPlusPlus/core/util/reflect') diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 617728cdec..722a4f3ff7 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -107,6 +107,9 @@ public class ReflectionUtils { * @return - Valid, {@link Class} object, or {@link null}. */ public static Class getClass(String aClassCanonicalName) { + if (aClassCanonicalName == null || aClassCanonicalName.length() <= 0) { + return null; + } Class y = mCachedClasses.get(aClassCanonicalName); if (y == null) { y = getClass_Internal(aClassCanonicalName); @@ -140,6 +143,9 @@ public class ReflectionUtils { * @return - Valid, non-final, {@link Method} object, or {@link null}. */ public static Method getMethod(Class aClass, String aMethodName, Class... aTypes) { + if (aClass == null || aMethodName == null || aMethodName.length() <= 0) { + return null; + } String aMethodKey = ArrayUtils.toString(aTypes); //Logger.REFLECTION("Looking up method in cache: "+(aClass.getName()+"."+aMethodName + "." + aMethodKey)); CachedMethod y = mCachedMethods.get(aClass.getName()+"."+aMethodName + "." + aMethodKey); @@ -166,6 +172,9 @@ public class ReflectionUtils { * @return - Valid, non-final, {@link Field} object, or {@link null}. */ public static Field getField(final Class aClass, final String aFieldName) { + if (aClass == null || aFieldName == null || aFieldName.length() <= 0) { + return null; + } CachedField y = mCachedFields.get(aClass.getName()+"."+aFieldName); if (y == null) { Field u; -- cgit