diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-03-01 04:20:08 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-03-01 04:20:08 +0000 |
commit | 9a0e88e397dc52476a0de92768c1022a3e53c9ed (patch) | |
tree | 857daacdc3ed3a0ff7f7051aa8ba2b3ff72d5f9e /src/Java/gtPlusPlus/core/util/reflect | |
parent | 35522722af5dddea144c841a71f4fa9087e68966 (diff) | |
download | GT5-Unofficial-9a0e88e397dc52476a0de92768c1022a3e53c9ed.tar.gz GT5-Unofficial-9a0e88e397dc52476a0de92768c1022a3e53c9ed.tar.bz2 GT5-Unofficial-9a0e88e397dc52476a0de92768c1022a3e53c9ed.zip |
+ Added casting recipes for all new materials (Hopefully).
$ Fixed localization of new TiCon materials.
$ Fixed bug where cached Fields/Methods may conflict, they're now stored with unique keys.
Diffstat (limited to 'src/Java/gtPlusPlus/core/util/reflect')
-rw-r--r-- | src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 88175b0a82..827ffbf5fb 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -72,27 +72,27 @@ public class ReflectionUtils { return false; } - private static boolean cacheMethod(Method aMethod) { + private static boolean cacheMethod(Class aClass, Method aMethod) { if (aMethod == null) { return false; } boolean isStatic = Modifier.isStatic(aMethod.getModifiers()); - CachedMethod y = mCachedMethods.get(aMethod.getName()+"."+aMethod.getParameterTypes().toString()); + CachedMethod y = mCachedMethods.get(aClass.getName()+"."+aMethod.getName()+"."+aMethod.getParameterTypes().toString()); if (y == null) { - mCachedMethods.put(aMethod.getName()+"."+aMethod.getParameterTypes().toString(), new CachedMethod(aMethod, isStatic)); + mCachedMethods.put(aClass.getName()+"."+aMethod.getName()+"."+aMethod.getParameterTypes().toString(), new CachedMethod(aMethod, isStatic)); return true; } return false; } - private static boolean cacheField(Field aField) { + private static boolean cacheField(Class aClass, Field aField) { if (aField == null) { return false; } boolean isStatic = Modifier.isStatic(aField.getModifiers()); - CachedField y = mCachedFields.get(aField.getName()); + CachedField y = mCachedFields.get(aClass.getName()+"."+aField.getName()); if (y == null) { - mCachedFields.put(aField.getName(), new CachedField(aField, isStatic)); + mCachedFields.put(aClass.getName()+"."+aField.getName(), new CachedField(aField, isStatic)); return true; } return false; @@ -139,12 +139,12 @@ public class ReflectionUtils { */ public static Method getMethod(Class aClass, String aMethodName, Class... aTypes) { String aMethodKey = aTypes.toString(); - CachedMethod y = mCachedMethods.get(aMethodName + "." + aMethodKey); + CachedMethod y = mCachedMethods.get(aClass.getName()+"."+aMethodName + "." + aMethodKey); if (y == null) { Method u = getMethod_Internal(aClass, aMethodName, aTypes); if (u != null) { Logger.REFLECTION("Caching Method: "+aMethodName + "." + aMethodKey); - cacheMethod(u); + cacheMethod(aClass, u); return u; } else { return null; @@ -163,14 +163,14 @@ public class ReflectionUtils { * @return - Valid, non-final, {@link Field} object, or {@link null}. */ public static Field getField(final Class aClass, final String aFieldName) { - CachedField y = mCachedFields.get(aFieldName); + CachedField y = mCachedFields.get(aClass.getName()+"."+aFieldName); if (y == null) { Field u; try { u = getField_Internal(aClass, aFieldName); if (u != null) { Logger.REFLECTION("Caching Field '"+aFieldName+"' from "+aClass.getCanonicalName()); - cacheField(u); + cacheField(aClass, u); return u; } } catch (NoSuchFieldException e) { |