Fix raw Class types

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@829364 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2009-10-24 13:37:46 +00:00
parent 6eab86bafd
commit fdb8010676
1 changed files with 29 additions and 29 deletions

View File

@ -124,7 +124,7 @@ public class MethodUtils {
args = ArrayUtils.EMPTY_OBJECT_ARRAY;
}
int arguments = args.length;
Class[] parameterTypes = new Class[arguments];
Class<?>[] parameterTypes = new Class[arguments];
for (int i = 0; i < arguments; i++) {
parameterTypes[i] = args[i].getClass();
}
@ -151,7 +151,7 @@ public class MethodUtils {
* @throws IllegalAccessException if the requested method is not accessible via reflection
*/
public static Object invokeMethod(Object object, String methodName,
Object[] args, Class[] parameterTypes)
Object[] args, Class<?>[] parameterTypes)
throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException {
if (parameterTypes == null) {
@ -220,7 +220,7 @@ public class MethodUtils {
args = ArrayUtils.EMPTY_OBJECT_ARRAY;
}
int arguments = args.length;
Class[] parameterTypes = new Class[arguments];
Class<?>[] parameterTypes = new Class[arguments];
for (int i = 0; i < arguments; i++) {
parameterTypes[i] = args[i].getClass();
}
@ -247,7 +247,7 @@ public class MethodUtils {
* via reflection
*/
public static Object invokeExactMethod(Object object, String methodName,
Object[] args, Class[] parameterTypes)
Object[] args, Class<?>[] parameterTypes)
throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException {
if (args == null) {
@ -285,8 +285,8 @@ public class MethodUtils {
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/
public static Object invokeExactStaticMethod(Class cls, String methodName,
Object[] args, Class[] parameterTypes)
public static Object invokeExactStaticMethod(Class<?> cls, String methodName,
Object[] args, Class<?>[] parameterTypes)
throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException {
if (args == null) {
@ -327,7 +327,7 @@ public class MethodUtils {
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/
public static Object invokeStaticMethod(Class cls, String methodName,
public static Object invokeStaticMethod(Class<?> cls, String methodName,
Object arg) throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException {
return invokeStaticMethod(cls, methodName, new Object[] { arg });
@ -357,14 +357,14 @@ public class MethodUtils {
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/
public static Object invokeStaticMethod(Class cls, String methodName,
public static Object invokeStaticMethod(Class<?> cls, String methodName,
Object[] args) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
if (args == null) {
args = ArrayUtils.EMPTY_OBJECT_ARRAY;
}
int arguments = args.length;
Class[] parameterTypes = new Class[arguments];
Class<?>[] parameterTypes = new Class[arguments];
for (int i = 0; i < arguments; i++) {
parameterTypes[i] = args[i].getClass();
}
@ -393,8 +393,8 @@ public class MethodUtils {
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/
public static Object invokeStaticMethod(Class cls, String methodName,
Object[] args, Class[] parameterTypes)
public static Object invokeStaticMethod(Class<?> cls, String methodName,
Object[] args, Class<?>[] parameterTypes)
throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException {
if (parameterTypes == null) {
@ -431,7 +431,7 @@ public class MethodUtils {
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/
public static Object invokeExactStaticMethod(Class cls, String methodName,
public static Object invokeExactStaticMethod(Class<?> cls, String methodName,
Object arg) throws NoSuchMethodException, IllegalAccessException,
InvocationTargetException {
return invokeExactStaticMethod(cls, methodName, new Object[] { arg });
@ -455,14 +455,14 @@ public class MethodUtils {
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/
public static Object invokeExactStaticMethod(Class cls, String methodName,
public static Object invokeExactStaticMethod(Class<?> cls, String methodName,
Object[] args) throws NoSuchMethodException,
IllegalAccessException, InvocationTargetException {
if (args == null) {
args = ArrayUtils.EMPTY_OBJECT_ARRAY;
}
int arguments = args.length;
Class[] parameterTypes = new Class[arguments];
Class<?>[] parameterTypes = new Class[arguments];
for (int i = 0; i < arguments; i++) {
parameterTypes[i] = args[i].getClass();
}
@ -481,10 +481,10 @@ public class MethodUtils {
* @param parameterType taking this type of parameter
* @return The accessible method
*/
public static Method getAccessibleMethod(Class cls, String methodName,
Class parameterType) {
public static Method getAccessibleMethod(Class<?> cls, String methodName,
Class<?> parameterType) {
return getAccessibleMethod(cls, methodName,
new Class[] { parameterType });
new Class<?>[] { parameterType });
}
/**
@ -499,8 +499,8 @@ public class MethodUtils {
* @param parameterTypes with these parameters types
* @return The accessible method
*/
public static Method getAccessibleMethod(Class cls, String methodName,
Class[] parameterTypes) {
public static Method getAccessibleMethod(Class<?> cls, String methodName,
Class<?>[] parameterTypes) {
try {
return getAccessibleMethod(cls.getMethod(methodName,
parameterTypes));
@ -522,12 +522,12 @@ public class MethodUtils {
return null;
}
// If the declaring class is public, we are done
Class cls = method.getDeclaringClass();
Class<?> cls = method.getDeclaringClass();
if (Modifier.isPublic(cls.getModifiers())) {
return method;
}
String methodName = method.getName();
Class[] parameterTypes = method.getParameterTypes();
Class<?>[] parameterTypes = method.getParameterTypes();
// Check the implemented interfaces and subinterfaces
method = getAccessibleMethodFromInterfaceNest(cls, methodName,
@ -550,9 +550,9 @@ public class MethodUtils {
* @param methodName Method name of the method we wish to call
* @param parameterTypes The parameter type signatures
*/
private static Method getAccessibleMethodFromSuperclass(Class cls,
String methodName, Class[] parameterTypes) {
Class parentClass = cls.getSuperclass();
private static Method getAccessibleMethodFromSuperclass(Class<?> cls,
String methodName, Class<?>[] parameterTypes) {
Class<?> parentClass = cls.getSuperclass();
while (parentClass != null) {
if (Modifier.isPublic(parentClass.getModifiers())) {
try {
@ -580,15 +580,15 @@ public class MethodUtils {
* @param methodName Method name of the method we wish to call
* @param parameterTypes The parameter type signatures
*/
private static Method getAccessibleMethodFromInterfaceNest(Class cls,
String methodName, Class[] parameterTypes) {
private static Method getAccessibleMethodFromInterfaceNest(Class<?> cls,
String methodName, Class<?>[] parameterTypes) {
Method method = null;
// Search up the superclass chain
for (; cls != null; cls = cls.getSuperclass()) {
// Check the implemented interfaces of the parent class
Class[] interfaces = cls.getInterfaces();
Class<?>[] interfaces = cls.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
// Is this interface public?
if (!Modifier.isPublic(interfaces[i].getModifiers())) {
@ -638,8 +638,8 @@ public class MethodUtils {
* @param parameterTypes find method with most compatible parameters
* @return The accessible method
*/
public static Method getMatchingAccessibleMethod(Class cls,
String methodName, Class[] parameterTypes) {
public static Method getMatchingAccessibleMethod(Class<?> cls,
String methodName, Class<?>[] parameterTypes) {
try {
Method method = cls.getMethod(methodName, parameterTypes);
MemberUtils.setAccessibleWorkaround(method);