diff --git a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxReflectionHelper.java b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxReflectionHelper.java index 8a76e2f..a768d35 100644 --- a/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxReflectionHelper.java +++ b/cocos/platform/android/java/src/org/cocos2dx/lib/Cocos2dxReflectionHelper.java @@ -31,14 +31,14 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; public class Cocos2dxReflectionHelper { - public static T getConstantValue(final Class aClass, final String constantName) { + public static T getConstantValue(final Class aClass, final String constantName) { try { return (T)aClass.getDeclaredField(constantName).get(null); } catch (NoSuchFieldException e) { Log.e("error", "can not find " + constantName + " in " + aClass.getName()); } catch (IllegalAccessException e) { - Log.e("error", constantName + " is not accessable"); + Log.e("error", constantName + " is not accessible"); } catch (IllegalArgumentException e) { Log.e("error", "arguments error when get " + constantName); @@ -50,13 +50,13 @@ public class Cocos2dxReflectionHelper { return null; } - public static T invokeInstanceMethod(final Object instance, final String methodName, - final Class[] parameterTypes, final Object[] parameters) { + public static void invokeInstanceMethod(final Object instance, final String methodName, + final Class[] parameterTypes, final Object[] parameters) { - final Class aClass = instance.getClass(); + final Class aClass = instance.getClass(); try { final Method method = aClass.getMethod(methodName, parameterTypes); - return (T)method.invoke(instance, parameters); + method.invoke(instance, parameters); } catch (NoSuchMethodException e) { Log.e("error", "can not find " + methodName + " in " + aClass.getName()); } @@ -70,6 +70,5 @@ public class Cocos2dxReflectionHelper { Log.e("error", "an exception was thrown by the invoked method when invoking " + methodName); } - return null; } }