This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 3ee80f041f Revert "Cache the result of `findMethod`"
3ee80f041f is described below

commit 3ee80f041feef071dcf261a02deaf1cc23035d14
Author: Daniel Sun <[email protected]>
AuthorDate: Sun Jan 5 06:50:39 2025 +0900

    Revert "Cache the result of `findMethod`"
    
    This reverts commit 4d87c32c81545eb6e2d3c884dcf6fddd70f79a75.
---
 src/main/java/groovy/lang/MetaClassImpl.java | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/src/main/java/groovy/lang/MetaClassImpl.java 
b/src/main/java/groovy/lang/MetaClassImpl.java
index 8a4089aa2e..549f8e1a11 100644
--- a/src/main/java/groovy/lang/MetaClassImpl.java
+++ b/src/main/java/groovy/lang/MetaClassImpl.java
@@ -57,7 +57,6 @@ import org.codehaus.groovy.runtime.callsite.PojoMetaClassSite;
 import org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite;
 import org.codehaus.groovy.runtime.callsite.StaticMetaClassSite;
 import org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite;
-import org.codehaus.groovy.runtime.memoize.LRUCache;
 import org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod;
 import org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl;
 import org.codehaus.groovy.runtime.metaclass.MetaMethodIndex;
@@ -3166,28 +3165,9 @@ public class MetaClassImpl implements MetaClass, 
MutableMetaClass {
         list.add(method);
     }
 
-    private static final MetaMethod NULL_METAMETHOD = new MetaMethod() {
-        @Override
-        public int getModifiers() { return 0; }
-        @Override
-        public String getName() { return ""; }
-        @Override
-        public Class getReturnType() { return null; }
-        @Override
-        public CachedClass getDeclaringClass() { return null; }
-        @Override
-        public Object invoke(Object object, Object[] arguments) { return null; 
}
-    };
-    private static final LRUCache<Method, MetaMethod> METHOD_CACHE = new 
LRUCache<>(512);
     private MetaMethod findMethod(Method method) {
-        MetaMethod result = METHOD_CACHE.getAndPut(method, m -> {
-            CachedMethod cachedMethod = CachedMethod.find(m);
-            MetaMethod metaMethod = cachedMethod == null ? null : 
findMethod(cachedMethod);
-            if (metaMethod == null) metaMethod = NULL_METAMETHOD;
-            return metaMethod;
-        });
-        if (result == NULL_METAMETHOD) result = null;
-        return result;
+        CachedMethod cachedMethod = CachedMethod.find(method);
+        return cachedMethod == null ? null : findMethod(cachedMethod);
     }
 
     /**

Reply via email to