From 50038d18ff263a144f7ab8ece6525318613184e9 Mon Sep 17 00:00:00 2001 From: Daniel Sun Date: Sat, 11 Jan 2025 00:30:03 +0900 Subject: [PATCH] Trivial tweak for `handleCache` --- .../codehaus/groovy/runtime/ConversionHandler.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/codehaus/groovy/runtime/ConversionHandler.java b/src/main/java/org/codehaus/groovy/runtime/ConversionHandler.java index 3babe01e46e..93e01cdafed 100644 --- a/src/main/java/org/codehaus/groovy/runtime/ConversionHandler.java +++ b/src/main/java/org/codehaus/groovy/runtime/ConversionHandler.java @@ -33,15 +33,16 @@ import java.lang.reflect.Proxy; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; /** * This class is a general adapter to map a call to a Java interface * to a given delegate. */ public abstract class ConversionHandler implements InvocationHandler, Serializable { - private final Object delegate; private static final long serialVersionUID = 1162833717190835227L; - private final ConcurrentHashMap handleCache = new ConcurrentHashMap<>(16, 0.9f, 2); + private final ConcurrentMap handleCache = new ConcurrentHashMap<>(16); + private final Object delegate; private MetaClass metaClass; /** @@ -104,10 +105,10 @@ public Object invoke(final Object proxy, final Method method, final Object[] arg try { if (method.getDeclaringClass() == GroovyObject.class) { switch (method.getName()) { - case "getMetaClass": - return getMetaClass(proxy); - case "setMetaClass": - return setMetaClass((MetaClass) args[0]); + case "getMetaClass": + return getMetaClass(proxy); + case "setMetaClass": + return setMetaClass((MetaClass) args[0]); } } return invokeCustom(proxy, method, args);