diff options
author | jonmv <venstad@gmail.com> | 2022-10-25 21:11:51 +0200 |
---|---|---|
committer | jonmv <venstad@gmail.com> | 2022-10-25 21:11:51 +0200 |
commit | 1e907223e59bc18ffd85e401f962da598e07a665 (patch) | |
tree | cdcacb8501cd00b17e662e8241897080dda61f22 /vespajlib | |
parent | dcb20bb39068128c208acd6e4ef47402ba792c63 (diff) |
Use actual class, not just its name, as method cache key
Diffstat (limited to 'vespajlib')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/collections/MethodCache.java | 6 |
1 files changed, 3 insertions, 3 deletions
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<String, Method> cache = new CopyOnWriteHashMap<>(); + private final CopyOnWriteHashMap<Class<?>, 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<String> 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; |