This is an automated email from the ASF dual-hosted git repository. emilles pushed a commit to branch GROOVY-11841 in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 19f011936b739e66e86764d3c4633d0d44d0130b Author: Eric Milles <[email protected]> AuthorDate: Thu Jan 15 08:55:56 2026 -0600 remove boundless property name map --- src/main/java/groovy/lang/MetaClassImpl.java | 29 ++++++---------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/src/main/java/groovy/lang/MetaClassImpl.java b/src/main/java/groovy/lang/MetaClassImpl.java index 3995facfe9..ac6e5ead70 100644 --- a/src/main/java/groovy/lang/MetaClassImpl.java +++ b/src/main/java/groovy/lang/MetaClassImpl.java @@ -109,7 +109,6 @@ import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.ConcurrentMap; import java.util.function.BiConsumer; import static groovy.lang.Tuple.tuple; @@ -269,10 +268,8 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass { @Override public List<MetaMethod> respondsTo(final Object obj, final String name) { Object o = getMethods(getTheClass(), name, false); - if (o instanceof FastArray) { - @SuppressWarnings("unchecked") - List<MetaMethod> l = ((FastArray) o).toList(); - return l; + if (o instanceof FastArray array) { + return (List<MetaMethod>) array.toList(); } return Collections.singletonList((MetaMethod) o); } @@ -2511,27 +2508,17 @@ public class MetaClassImpl implements MetaClass, MutableMetaClass { Object propertyMethods = filterPropertyMethod(isThis ? e.methods : e.methodsForSuper, isGetter, isBooleanGetter); if (propertyMethods == null) continue; - String propName = getPropName(methodName); - if (propertyMethods instanceof MetaMethod) { - createMetaBeanProperty(target, propName, isGetter, (MetaMethod) propertyMethods); + String propertyName = BeanUtils.decapitalize(methodName.substring(isBooleanGetter ? 2 : 3)); + if (propertyMethods instanceof MetaMethod propertyMethod) { + createMetaBeanProperty(target, propertyName, isGetter, propertyMethod); } else { for (MetaMethod m : (Iterable<MetaMethod>) propertyMethods) { - createMetaBeanProperty(target, propName, isGetter, m); + createMetaBeanProperty(target, propertyName, isGetter, m); } } } } - private static final ConcurrentMap<String, String> PROP_NAMES = new ConcurrentHashMap<>(1024); - - private static String getPropName(String methodName) { - return PROP_NAMES.computeIfAbsent(methodName, k -> { - // assume "is" or "[gs]et" - return BeanUtils.decapitalize(methodName.startsWith("is") - ? methodName.substring(2) : methodName.substring(3)); - }); - } - private static MetaProperty makeReplacementMetaProperty(MetaProperty mp, String propName, boolean isGetter, MetaMethod propertyMethod) { if (mp == null) { if (isGetter) { @@ -3836,10 +3823,6 @@ out: if (metaClass instanceof MetaClassImpl metaClassImpl) { return null; } - public ParameterTypes getParamTypes() { - return null; - } - @Override public Object invoke(Object object, Object[] arguments) { return null;
