diff --git a/core/src/main/java/top/niunaijun/blackreflection/BlackReflection.java b/core/src/main/java/top/niunaijun/blackreflection/BlackReflection.java index 0134fe4..a987784 100644 --- a/core/src/main/java/top/niunaijun/blackreflection/BlackReflection.java +++ b/core/src/main/java/top/niunaijun/blackreflection/BlackReflection.java @@ -52,15 +52,15 @@ public static T create(Class clazz, final Object caller, boolean withExce return (T) o; } } -// else { -// Map, Object> callerClassMap = sCallerProxyCache.get(caller); -// if (callerClassMap != null) { -// Object o = callerClassMap.get(clazz); -// if (o != null) { -// return (T) o; -// } -// } -// } + else { + Map, Object> callerClassMap = sCallerProxyCache.get(caller); + if (callerClassMap != null) { + Object o = callerClassMap.get(clazz); + if (o != null) { + return (T) o; + } + } + } } final WeakReference weakCaller = caller == null ? null : new WeakReference<>(caller); @@ -84,7 +84,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl Object call; Reflector on = Reflector.on(aClass).field(name); if (isStatic) { - call = on.get(args); + call = on.get(); } else { if (callerByWeak == null) { return generateNullValue(returnType); @@ -169,12 +169,12 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl if (caller == null) { sProxyCache.put(clazz, o); } else { -// Map, Object> callerClassMap = sCallerProxyCache.get(caller); -// if (callerClassMap == null) { -// callerClassMap = new HashMap<>(); -// sCallerProxyCache.put(caller, callerClassMap); -// } -// callerClassMap.put(clazz, o); + Map, Object> callerClassMap = sCallerProxyCache.get(caller); + if (callerClassMap == null) { + callerClassMap = new HashMap<>(); + sCallerProxyCache.put(caller, callerClassMap); + } + callerClassMap.put(clazz, o); } return (T) o; } catch (ClassNotFoundException e) {