You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/08/16 20:46:59 UTC
(commons-beanutils) 02/06: Remove unused org.apache.commons.beanutils2.MethodUtils.invokeExactStaticMethod(Class, String, Object[], Class[]) in favor of Apache Commons Lang's org.apache.commons.lang3.reflect.MethodUtils
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git
commit 46bdc231df7bbb673e306e7060893d2f51b2ff99
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sat Aug 16 16:23:11 2025 -0400
Remove unused
org.apache.commons.beanutils2.MethodUtils.invokeExactStaticMethod(Class,
String, Object[], Class[]) in favor of Apache Commons Lang's
org.apache.commons.lang3.reflect.MethodUtils
---
src/changes/changes.xml | 1 +
.../org/apache/commons/beanutils2/MethodUtils.java | 35 ----------------------
2 files changed, 1 insertion(+), 35 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bd909581..cdf324e3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -48,6 +48,7 @@
<action dev="ggregory" type="remove" due-to="Gary Gregory">Remove unused org.apache.commons.beanutils2.MethodUtils.invokeMethod(Object, String, Object[]) in favor of Apache Commons Lang's org.apache.commons.lang3.reflect.MethodUtils.</action>
<action dev="ggregory" type="remove" due-to="Gary Gregory">Remove unused org.apache.commons.beanutils2.MethodUtils.invokeStaticMethod(Class, String, Object[]) in favor of Apache Commons Lang's org.apache.commons.lang3.reflect.MethodUtils.</action>
<action dev="ggregory" type="remove" due-to="Gary Gregory">Remove unused org.apache.commons.beanutils2.MethodUtils.invokeStaticMethod(Class, String, Object[], Class[]) in favor of Apache Commons Lang's org.apache.commons.lang3.reflect.MethodUtils.</action>
+ <action dev="ggregory" type="remove" due-to="Gary Gregory">Remove unused org.apache.commons.beanutils2.MethodUtils.invokeExactStaticMethod(Class, String, Object[], Class[]) in favor of Apache Commons Lang's org.apache.commons.lang3.reflect.MethodUtils.</action>
<action dev="ggregory" type="remove" due-to="Gary Gregory">Remove unused org.apache.commons.beanutils2.MethodUtils.toNonPrimitiveClass(Class) in favor of org.apache.commons.lang3.ClassUtils.primitiveToWrapper(Class).</action>
<action dev="ggregory" type="remove" due-to="Gary Gregory">Remove unused org.apache.commons.beanutils2.MethodUtils.getPrimitiveType(Class) in favor of org.apache.commons.lang3.ClassUtils.wrapperToPrimitive(Class).</action>
<action dev="ggregory" type="remove" due-to="Gary Gregory">Remove org.apache.commons.beanutils2.MethodUtils.getPrimitiveWrapper(Class) in favor of org.apache.commons.lang3.ClassUtils.primitiveToWrapper(Class).</action>
diff --git a/src/main/java/org/apache/commons/beanutils2/MethodUtils.java b/src/main/java/org/apache/commons/beanutils2/MethodUtils.java
index 6f6202ca..b458252c 100644
--- a/src/main/java/org/apache/commons/beanutils2/MethodUtils.java
+++ b/src/main/java/org/apache/commons/beanutils2/MethodUtils.java
@@ -551,41 +551,6 @@ public final class MethodUtils {
return method.invoke(object, args);
}
- /**
- * Invoke a static method whose parameter types match exactly the parameter types given.
- *
- * <p>
- * This uses reflection to invoke the method obtained from a call to {@link #getAccessibleMethod(Class, String, Class[])}.
- * </p>
- *
- * @param objectClass invoke static method on this class.
- * @param methodName get method with this name.
- * @param args use these arguments - treat null as empty array (passing null will result in calling the parameterless method with name
- * {@code methodName}).
- * @param parameterTypes match these parameters - treat null as empty array.
- * @return The value returned by the invoked method.
- * @throws NoSuchMethodException if there is no such accessible method.
- * @throws InvocationTargetException wraps an exception thrown by the method invoked.
- * @throws IllegalAccessException if the requested method is not accessible via reflection.
- * @since 1.8.0
- */
- public static Object invokeExactStaticMethod(final Class<?> objectClass, final String methodName, Object[] args, Class<?>[] parameterTypes)
- throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
- if (args == null) {
- args = BeanUtils.EMPTY_OBJECT_ARRAY;
- }
-
- if (parameterTypes == null) {
- parameterTypes = BeanUtils.EMPTY_CLASS_ARRAY;
- }
-
- final Method method = getAccessibleMethod(objectClass, methodName, parameterTypes);
- if (method == null) {
- throw new NoSuchMethodException("No such accessible method: " + methodName + "() on class: " + objectClass.getName());
- }
- return method.invoke(null, args);
- }
-
/**
* Invoke a named method whose parameter type matches the object type.
*