Inline single use local variables.

Minor Javadoc tweak.
This commit is contained in:
Gary Gregory 2021-08-27 16:18:19 -04:00
parent 94ffa01a03
commit c45f0b8a5b
4 changed files with 14 additions and 26 deletions

View File

@ -80,8 +80,7 @@ public class ConstructorUtils {
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
InstantiationException {
args = ArrayUtils.nullToEmpty(args);
final Class<?>[] parameterTypes = ClassUtils.toClass(args);
return invokeConstructor(cls, args, parameterTypes);
return invokeConstructor(cls, args, ClassUtils.toClass(args));
}
/**
@ -144,8 +143,7 @@ public class ConstructorUtils {
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
InstantiationException {
args = ArrayUtils.nullToEmpty(args);
final Class<?>[] parameterTypes = ClassUtils.toClass(args);
return invokeExactConstructor(cls, args, parameterTypes);
return invokeExactConstructor(cls, args, ClassUtils.toClass(args));
}
/**

View File

@ -196,8 +196,7 @@ public class FieldUtils {
* @since 3.2
*/
public static Field[] getAllFields(final Class<?> cls) {
final List<Field> allFieldsList = getAllFieldsList(cls);
return allFieldsList.toArray(ArrayUtils.EMPTY_FIELD_ARRAY);
return getAllFieldsList(cls).toArray(ArrayUtils.EMPTY_FIELD_ARRAY);
}
/**
@ -234,8 +233,7 @@ public class FieldUtils {
* @since 3.4
*/
public static Field[] getFieldsWithAnnotation(final Class<?> cls, final Class<? extends Annotation> annotationCls) {
final List<Field> annotatedFieldsList = getFieldsListWithAnnotation(cls, annotationCls);
return annotatedFieldsList.toArray(ArrayUtils.EMPTY_FIELD_ARRAY);
return getFieldsListWithAnnotation(cls, annotationCls).toArray(ArrayUtils.EMPTY_FIELD_ARRAY);
}
/**

View File

@ -40,7 +40,7 @@ abstract class MemberUtils {
Character.TYPE, Integer.TYPE, Long.TYPE, Float.TYPE, Double.TYPE };
/**
* XXX Default access superclass workaround.
* Default access superclass workaround.
*
* When a {@code public} class has a default access superclass with {@code public} members,
* these members are accessible. Calling them from compiled code works fine.

View File

@ -150,8 +150,7 @@ public class MethodUtils {
Object... args) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
args = ArrayUtils.nullToEmpty(args);
final Class<?>[] parameterTypes = ClassUtils.toClass(args);
return invokeMethod(object, methodName, args, parameterTypes);
return invokeMethod(object, methodName, args, ClassUtils.toClass(args));
}
/**
@ -181,8 +180,7 @@ public class MethodUtils {
Object... args) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
args = ArrayUtils.nullToEmpty(args);
final Class<?>[] parameterTypes = ClassUtils.toClass(args);
return invokeMethod(object, forceAccess, methodName, args, parameterTypes);
return invokeMethod(object, forceAccess, methodName, args, ClassUtils.toClass(args));
}
/**
@ -307,8 +305,7 @@ public class MethodUtils {
Object... args) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
args = ArrayUtils.nullToEmpty(args);
final Class<?>[] parameterTypes = ClassUtils.toClass(args);
return invokeExactMethod(object, methodName, args, parameterTypes);
return invokeExactMethod(object, methodName, args, ClassUtils.toClass(args));
}
/**
@ -407,8 +404,7 @@ public class MethodUtils {
Object... args) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
args = ArrayUtils.nullToEmpty(args);
final Class<?>[] parameterTypes = ClassUtils.toClass(args);
return invokeStaticMethod(cls, methodName, args, parameterTypes);
return invokeStaticMethod(cls, methodName, args, ClassUtils.toClass(args));
}
/**
@ -522,8 +518,7 @@ public class MethodUtils {
Object... args) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
args = ArrayUtils.nullToEmpty(args);
final Class<?>[] parameterTypes = ClassUtils.toClass(args);
return invokeExactStaticMethod(cls, methodName, args, parameterTypes);
return invokeExactStaticMethod(cls, methodName, args, ClassUtils.toClass(args));
}
/**
@ -541,8 +536,7 @@ public class MethodUtils {
public static Method getAccessibleMethod(final Class<?> cls, final String methodName,
final Class<?>... parameterTypes) {
try {
return getAccessibleMethod(cls.getMethod(methodName,
parameterTypes));
return getAccessibleMethod(cls.getMethod(methodName, parameterTypes));
} catch (final NoSuchMethodException e) {
return null;
}
@ -910,9 +904,7 @@ public class MethodUtils {
*/
public static Method[] getMethodsWithAnnotation(final Class<?> cls, final Class<? extends Annotation> annotationCls,
final boolean searchSupers, final boolean ignoreAccess) {
final List<Method> annotatedMethodsList = getMethodsListWithAnnotation(cls, annotationCls, searchSupers,
ignoreAccess);
return annotatedMethodsList.toArray(ArrayUtils.EMPTY_METHOD_ARRAY);
return getMethodsListWithAnnotation(cls, annotationCls, searchSupers, ignoreAccess).toArray(ArrayUtils.EMPTY_METHOD_ARRAY);
}
/**