aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/util/reflect
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/core/util/reflect')
-rw-r--r--src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
index 59d20835ae..8b9b5cf94f 100644
--- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
+++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
@@ -537,17 +537,17 @@ public class ReflectionUtils {
public static Object invokeNonBool(Object objectInstance, Method method, Object[] values){
- if (objectInstance == null || method == null || values == null){
+ if ((!ReflectionUtils.isStaticMethod(method) && objectInstance == null) || method == null || values == null){
return false;
}
String methodName = method.getName();
- Class<?> mLocalClass = (objectInstance instanceof Class ? (Class<?>) objectInstance : objectInstance.getClass());
- Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+mLocalClass.getCanonicalName()+".");
+ String classname = objectInstance != null ? objectInstance.getClass().getCanonicalName() : method.getDeclaringClass().getCanonicalName();
+ Logger.REFLECTION("Trying to invoke "+methodName+" on an instance of "+classname+".");
try {
return method.invoke(objectInstance, values);
}
catch (SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+mLocalClass.getName());
+ Logger.REFLECTION("Failed to Dynamically invoke "+methodName+" on an object of type: "+classname);
}
Logger.REFLECTION("Invoke failed or did something wrong.");