Fix [varargs] compiler warnings
Remove unnecessary 'null' argument from calls to vararg supported methods and fix cast in ValidationUtils.invokeValidator().
This commit is contained in:
parent
731d5be644
commit
7f0aa5cfb2
|
@ -314,14 +314,14 @@ public class CallbacksSecurityTests {
|
|||
}
|
||||
|
||||
final CustomCallbackBean bean = new CustomCallbackBean();
|
||||
final Method method = bean.getClass().getMethod("destroy", null);
|
||||
final Method method = bean.getClass().getMethod("destroy");
|
||||
method.setAccessible(true);
|
||||
|
||||
try {
|
||||
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
|
||||
|
||||
public Object run() throws Exception {
|
||||
method.invoke(bean, null);
|
||||
method.invoke(bean);
|
||||
return null;
|
||||
}
|
||||
}, acc);
|
||||
|
|
|
@ -52,7 +52,7 @@ public abstract class ValidationUtils {
|
|||
* the validation of the supplied object's type
|
||||
*/
|
||||
public static void invokeValidator(Validator validator, Object obj, Errors errors) {
|
||||
invokeValidator(validator, obj, errors, (Class[]) null);
|
||||
invokeValidator(validator, obj, errors, (Object[]) null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -72,7 +72,7 @@ public class MethodExclusionMBeanInfoAssemblerTests extends AbstractJmxAssembler
|
|||
Properties ignored = new Properties();
|
||||
ignored.setProperty(beanKey, "dontExposeMe,setSuperman");
|
||||
assembler.setIgnoredMethodMappings(ignored);
|
||||
Method method = JmxTestBean.class.getMethod("dontExposeMe", null);
|
||||
Method method = JmxTestBean.class.getMethod("dontExposeMe");
|
||||
assertFalse(assembler.isNotIgnored(method, beanKey));
|
||||
// this bean does not have any ignored methods on it, so must obviously not be ignored...
|
||||
assertTrue(assembler.isNotIgnored(method, "someOtherBeanKey"));
|
||||
|
|
|
@ -185,7 +185,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
|
|||
assertEquals("x", names[1]);
|
||||
assertEquals("i", names[2]);
|
||||
|
||||
m = clazz.getMethod("getDate", null);
|
||||
m = clazz.getMethod("getDate");
|
||||
names = discoverer.getParameterNames(m);
|
||||
assertEquals(0, names.length);
|
||||
|
||||
|
@ -202,7 +202,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
|
|||
Class clazz = Component.class;
|
||||
String methodName = "list";
|
||||
|
||||
Method m = clazz.getMethod(methodName, null);
|
||||
Method m = clazz.getMethod(methodName);
|
||||
String[] names = discoverer.getParameterNames(m);
|
||||
assertNull(names);
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ public class ToStringCreatorTests extends TestCase {
|
|||
}
|
||||
|
||||
public void testMethod() throws Exception {
|
||||
String str = new ToStringCreator(this).append("myMethod", this.getClass().getMethod("testMethod", null))
|
||||
String str = new ToStringCreator(this).append("myMethod", this.getClass().getMethod("testMethod"))
|
||||
.toString();
|
||||
assertEquals("[ToStringCreatorTests@" + ObjectUtils.getIdentityHexString(this)
|
||||
+ " myMethod = testMethod@ToStringCreatorTests]", str);
|
||||
|
|
|
@ -171,14 +171,14 @@ public class ClassUtilsTests extends TestCase {
|
|||
}
|
||||
|
||||
public void testHasMethod() throws Exception {
|
||||
assertTrue(ClassUtils.hasMethod(Collection.class, "size", null));
|
||||
assertTrue(ClassUtils.hasMethod(Collection.class, "remove", new Class[] {Object.class}));
|
||||
assertFalse(ClassUtils.hasMethod(Collection.class, "remove", null));
|
||||
assertFalse(ClassUtils.hasMethod(Collection.class, "someOtherMethod", null));
|
||||
assertTrue(ClassUtils.hasMethod(Collection.class, "size"));
|
||||
assertTrue(ClassUtils.hasMethod(Collection.class, "remove", Object.class));
|
||||
assertFalse(ClassUtils.hasMethod(Collection.class, "remove"));
|
||||
assertFalse(ClassUtils.hasMethod(Collection.class, "someOtherMethod"));
|
||||
}
|
||||
|
||||
public void testGetMethodIfAvailable() throws Exception {
|
||||
Method method = ClassUtils.getMethodIfAvailable(Collection.class, "size", null);
|
||||
Method method = ClassUtils.getMethodIfAvailable(Collection.class, "size");
|
||||
assertNotNull(method);
|
||||
assertEquals("size", method.getName());
|
||||
|
||||
|
@ -186,8 +186,8 @@ public class ClassUtilsTests extends TestCase {
|
|||
assertNotNull(method);
|
||||
assertEquals("remove", method.getName());
|
||||
|
||||
assertNull(ClassUtils.getMethodIfAvailable(Collection.class, "remove", null));
|
||||
assertNull(ClassUtils.getMethodIfAvailable(Collection.class, "someOtherMethod", null));
|
||||
assertNull(ClassUtils.getMethodIfAvailable(Collection.class, "remove"));
|
||||
assertNull(ClassUtils.getMethodIfAvailable(Collection.class, "someOtherMethod"));
|
||||
}
|
||||
|
||||
public void testGetMethodCountForName() {
|
||||
|
|
Loading…
Reference in New Issue