aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/util/reflect
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2019-03-01 05:15:22 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2019-03-01 05:15:22 +0000
commitb126379ca7e069c93c3b42a7e87e77c209a894c3 (patch)
treef0cdfdd9e6d109a57d11e5bf4a2844c7ca991ff4 /src/Java/gtPlusPlus/core/util/reflect
parent9a0e88e397dc52476a0de92768c1022a3e53c9ed (diff)
downloadGT5-Unofficial-b126379ca7e069c93c3b42a7e87e77c209a894c3.tar.gz
GT5-Unofficial-b126379ca7e069c93c3b42a7e87e77c209a894c3.tar.bz2
GT5-Unofficial-b126379ca7e069c93c3b42a7e87e77c209a894c3.zip
$ Final fixes to TiCon reflective integration. Now to just tweak the added content and rebalance.
$ Fixed hand mix Tumbaga recipe inconsistency.
Diffstat (limited to 'src/Java/gtPlusPlus/core/util/reflect')
-rw-r--r--src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
index 827ffbf5fb..617728cdec 100644
--- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
+++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java
@@ -9,6 +9,8 @@ import java.lang.reflect.Modifier;
import java.util.LinkedHashMap;
import java.util.Map;
+import org.apache.commons.lang3.ArrayUtils;
+
import com.google.common.reflect.ClassPath;
import gtPlusPlus.api.objects.Logger;
@@ -77,9 +79,9 @@ public class ReflectionUtils {
return false;
}
boolean isStatic = Modifier.isStatic(aMethod.getModifiers());
- CachedMethod y = mCachedMethods.get(aClass.getName()+"."+aMethod.getName()+"."+aMethod.getParameterTypes().toString());
+ CachedMethod y = mCachedMethods.get(aClass.getName()+"."+aMethod.getName()+"."+ArrayUtils.toString(aMethod.getParameterTypes()));
if (y == null) {
- mCachedMethods.put(aClass.getName()+"."+aMethod.getName()+"."+aMethod.getParameterTypes().toString(), new CachedMethod(aMethod, isStatic));
+ mCachedMethods.put(aClass.getName()+"."+aMethod.getName()+"."+ArrayUtils.toString(aMethod.getParameterTypes()), new CachedMethod(aMethod, isStatic));
return true;
}
return false;
@@ -138,7 +140,8 @@ public class ReflectionUtils {
* @return - Valid, non-final, {@link Method} object, or {@link null}.
*/
public static Method getMethod(Class aClass, String aMethodName, Class... aTypes) {
- String aMethodKey = aTypes.toString();
+ String aMethodKey = ArrayUtils.toString(aTypes);
+ //Logger.REFLECTION("Looking up method in cache: "+(aClass.getName()+"."+aMethodName + "." + aMethodKey));
CachedMethod y = mCachedMethods.get(aClass.getName()+"."+aMethodName + "." + aMethodKey);
if (y == null) {
Method u = getMethod_Internal(aClass, aMethodName, aTypes);
@@ -169,7 +172,7 @@ public class ReflectionUtils {
try {
u = getField_Internal(aClass, aFieldName);
if (u != null) {
- Logger.REFLECTION("Caching Field '"+aFieldName+"' from "+aClass.getCanonicalName());
+ Logger.REFLECTION("Caching Field '"+aFieldName+"' from "+aClass.getName());
cacheField(aClass, u);
return u;
}
@@ -426,16 +429,20 @@ public class ReflectionUtils {
private static Field getField_Internal(final Class<?> clazz, final String fieldName) throws NoSuchFieldException {
try {
+ Logger.REFLECTION("Field: Internal Lookup: "+fieldName);
Field k = clazz.getDeclaredField(fieldName);
makeFieldAccessible(k);
//Logger.REFLECTION("Got Field from Class. "+fieldName+" did exist within "+clazz.getCanonicalName()+".");
return k;
} catch (final NoSuchFieldException e) {
+ Logger.REFLECTION("Field: Internal Lookup Failed: "+fieldName);
final Class<?> superClass = clazz.getSuperclass();
if (superClass == null) {
+ Logger.REFLECTION("Unable to find field '"+fieldName+"'");
//Logger.REFLECTION("Failed to get Field from Class. "+fieldName+" does not existing within "+clazz.getCanonicalName()+".");
throw e;
}
+ Logger.REFLECTION("Method: Recursion Lookup: "+fieldName+" - Checking in "+superClass.getName());
//Logger.REFLECTION("Failed to get Field from Class. "+fieldName+" does not existing within "+clazz.getCanonicalName()+". Trying super class.");
return getField_Internal(superClass, fieldName);
}
@@ -511,7 +518,7 @@ public class ReflectionUtils {
}
private static void dumpClassInfo(Class aClass) {
- Logger.INFO("We ran into an error processing reflection in "+aClass.getCanonicalName()+", dumping all data for debugging.");
+ Logger.INFO("We ran into an error processing reflection in "+aClass.getName()+", dumping all data for debugging.");
// Get the methods
Method[] methods = aClass.getDeclaredMethods();
Field[] fields = aClass.getDeclaredFields();