Skip to content

Commit 3ee80f0

Browse files
committed
Revert "Cache the result of findMethod"
This reverts commit 4d87c32.
1 parent 4d87c32 commit 3ee80f0

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

Diff for: src/main/java/groovy/lang/MetaClassImpl.java

+2-22
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
import org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite;
5858
import org.codehaus.groovy.runtime.callsite.StaticMetaClassSite;
5959
import org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite;
60-
import org.codehaus.groovy.runtime.memoize.LRUCache;
6160
import org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod;
6261
import org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl;
6362
import org.codehaus.groovy.runtime.metaclass.MetaMethodIndex;
@@ -3166,28 +3165,9 @@ private static void filterMatchingMethodForCategory(FastArray list, MetaMethod m
31663165
list.add(method);
31673166
}
31683167

3169-
private static final MetaMethod NULL_METAMETHOD = new MetaMethod() {
3170-
@Override
3171-
public int getModifiers() { return 0; }
3172-
@Override
3173-
public String getName() { return ""; }
3174-
@Override
3175-
public Class getReturnType() { return null; }
3176-
@Override
3177-
public CachedClass getDeclaringClass() { return null; }
3178-
@Override
3179-
public Object invoke(Object object, Object[] arguments) { return null; }
3180-
};
3181-
private static final LRUCache<Method, MetaMethod> METHOD_CACHE = new LRUCache<>(512);
31823168
private MetaMethod findMethod(Method method) {
3183-
MetaMethod result = METHOD_CACHE.getAndPut(method, m -> {
3184-
CachedMethod cachedMethod = CachedMethod.find(m);
3185-
MetaMethod metaMethod = cachedMethod == null ? null : findMethod(cachedMethod);
3186-
if (metaMethod == null) metaMethod = NULL_METAMETHOD;
3187-
return metaMethod;
3188-
});
3189-
if (result == NULL_METAMETHOD) result = null;
3190-
return result;
3169+
CachedMethod cachedMethod = CachedMethod.find(method);
3170+
return cachedMethod == null ? null : findMethod(cachedMethod);
31913171
}
31923172

31933173
/**

0 commit comments

Comments
 (0)