From b339d7588519dde23bd61c969df4af8374ae8a37 Mon Sep 17 00:00:00 2001 From: Milk <1871357815@qq.com> Date: Sat, 19 Mar 2022 14:53:45 +0800 Subject: [PATCH] Support set use CACHE --- .../java/top/niunaijun/blackreflection/BlackReflection.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/src/main/java/top/niunaijun/blackreflection/BlackReflection.java b/core/src/main/java/top/niunaijun/blackreflection/BlackReflection.java index 19566c1..fe97753 100644 --- a/core/src/main/java/top/niunaijun/blackreflection/BlackReflection.java +++ b/core/src/main/java/top/niunaijun/blackreflection/BlackReflection.java @@ -34,6 +34,7 @@ @SuppressWarnings("unchecked") public class BlackReflection { public static boolean DEBUG = false; + public static boolean CACHE = false; private static final Map, Object> sProxyCache = new HashMap<>(); // key caller @@ -180,6 +181,9 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl } private static T getProxy(Class clazz, final Object caller, boolean withException) { + if (!CACHE) { + return null; + } try { if (!withException) { if (caller == null) {