From 1e907223e59bc18ffd85e401f962da598e07a665 Mon Sep 17 00:00:00 2001 From: jonmv Date: Tue, 25 Oct 2022 21:11:51 +0200 Subject: Use actual class, not just its name, as method cache key --- vespajlib/src/main/java/com/yahoo/collections/MethodCache.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'vespajlib') diff --git a/vespajlib/src/main/java/com/yahoo/collections/MethodCache.java b/vespajlib/src/main/java/com/yahoo/collections/MethodCache.java index bf9200efb2e..c0beeb2da92 100644 --- a/vespajlib/src/main/java/com/yahoo/collections/MethodCache.java +++ b/vespajlib/src/main/java/com/yahoo/collections/MethodCache.java @@ -16,7 +16,7 @@ import java.util.function.Consumer; public final class MethodCache { private final String methodName; - private final CopyOnWriteHashMap cache = new CopyOnWriteHashMap<>(); + private final CopyOnWriteHashMap, Method> cache = new CopyOnWriteHashMap<>(); public MethodCache(String methodName) { this.methodName = methodName; @@ -34,13 +34,13 @@ public final class MethodCache { return get(object, null); } public Method get(Object object, Consumer onPut) { - Method m = cache.get(object.getClass().getName()); + Method m = cache.get(object.getClass()); if (m == null) { m = lookupMethod(object); if (m != null) { if (onPut != null) onPut.accept(object.getClass().getName()); - cache.put(object.getClass().getName(), m); + cache.put(object.getClass(), m); } } return m; -- cgit v1.2.3