Skip to content

Commit

Permalink
Trivial tweak for handleCache
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellansun committed Jan 10, 2025
1 parent de71720 commit 50038d1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/java/org/codehaus/groovy/runtime/ConversionHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Method, Object> handleCache = new ConcurrentHashMap<>(16, 0.9f, 2);
private final ConcurrentMap<Method, Object> handleCache = new ConcurrentHashMap<>(16);
private final Object delegate;
private MetaClass metaClass;

/**
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 50038d1

Please sign in to comment.