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:
Phillip Webb 2012-12-19 14:40:17 -08:00 committed by Chris Beams
parent 731d5be644
commit 7f0aa5cfb2
6 changed files with 14 additions and 14 deletions

View File

@ -314,14 +314,14 @@ public class CallbacksSecurityTests {
} }
final CustomCallbackBean bean = new CustomCallbackBean(); final CustomCallbackBean bean = new CustomCallbackBean();
final Method method = bean.getClass().getMethod("destroy", null); final Method method = bean.getClass().getMethod("destroy");
method.setAccessible(true); method.setAccessible(true);
try { try {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception { public Object run() throws Exception {
method.invoke(bean, null); method.invoke(bean);
return null; return null;
} }
}, acc); }, acc);

View File

@ -52,7 +52,7 @@ public abstract class ValidationUtils {
* the validation of the supplied object's type * the validation of the supplied object's type
*/ */
public static void invokeValidator(Validator validator, Object obj, Errors errors) { public static void invokeValidator(Validator validator, Object obj, Errors errors) {
invokeValidator(validator, obj, errors, (Class[]) null); invokeValidator(validator, obj, errors, (Object[]) null);
} }
/** /**

View File

@ -72,7 +72,7 @@ public class MethodExclusionMBeanInfoAssemblerTests extends AbstractJmxAssembler
Properties ignored = new Properties(); Properties ignored = new Properties();
ignored.setProperty(beanKey, "dontExposeMe,setSuperman"); ignored.setProperty(beanKey, "dontExposeMe,setSuperman");
assembler.setIgnoredMethodMappings(ignored); assembler.setIgnoredMethodMappings(ignored);
Method method = JmxTestBean.class.getMethod("dontExposeMe", null); Method method = JmxTestBean.class.getMethod("dontExposeMe");
assertFalse(assembler.isNotIgnored(method, beanKey)); assertFalse(assembler.isNotIgnored(method, beanKey));
// this bean does not have any ignored methods on it, so must obviously not be ignored... // this bean does not have any ignored methods on it, so must obviously not be ignored...
assertTrue(assembler.isNotIgnored(method, "someOtherBeanKey")); assertTrue(assembler.isNotIgnored(method, "someOtherBeanKey"));

View File

@ -185,7 +185,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
assertEquals("x", names[1]); assertEquals("x", names[1]);
assertEquals("i", names[2]); assertEquals("i", names[2]);
m = clazz.getMethod("getDate", null); m = clazz.getMethod("getDate");
names = discoverer.getParameterNames(m); names = discoverer.getParameterNames(m);
assertEquals(0, names.length); assertEquals(0, names.length);
@ -202,7 +202,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
Class clazz = Component.class; Class clazz = Component.class;
String methodName = "list"; String methodName = "list";
Method m = clazz.getMethod(methodName, null); Method m = clazz.getMethod(methodName);
String[] names = discoverer.getParameterNames(m); String[] names = discoverer.getParameterNames(m);
assertNull(names); assertNull(names);

View File

@ -111,7 +111,7 @@ public class ToStringCreatorTests extends TestCase {
} }
public void testMethod() throws Exception { 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(); .toString();
assertEquals("[ToStringCreatorTests@" + ObjectUtils.getIdentityHexString(this) assertEquals("[ToStringCreatorTests@" + ObjectUtils.getIdentityHexString(this)
+ " myMethod = testMethod@ToStringCreatorTests]", str); + " myMethod = testMethod@ToStringCreatorTests]", str);

View File

@ -171,14 +171,14 @@ public class ClassUtilsTests extends TestCase {
} }
public void testHasMethod() throws Exception { public void testHasMethod() throws Exception {
assertTrue(ClassUtils.hasMethod(Collection.class, "size", null)); assertTrue(ClassUtils.hasMethod(Collection.class, "size"));
assertTrue(ClassUtils.hasMethod(Collection.class, "remove", new Class[] {Object.class})); assertTrue(ClassUtils.hasMethod(Collection.class, "remove", Object.class));
assertFalse(ClassUtils.hasMethod(Collection.class, "remove", null)); assertFalse(ClassUtils.hasMethod(Collection.class, "remove"));
assertFalse(ClassUtils.hasMethod(Collection.class, "someOtherMethod", null)); assertFalse(ClassUtils.hasMethod(Collection.class, "someOtherMethod"));
} }
public void testGetMethodIfAvailable() throws Exception { public void testGetMethodIfAvailable() throws Exception {
Method method = ClassUtils.getMethodIfAvailable(Collection.class, "size", null); Method method = ClassUtils.getMethodIfAvailable(Collection.class, "size");
assertNotNull(method); assertNotNull(method);
assertEquals("size", method.getName()); assertEquals("size", method.getName());
@ -186,8 +186,8 @@ public class ClassUtilsTests extends TestCase {
assertNotNull(method); assertNotNull(method);
assertEquals("remove", method.getName()); assertEquals("remove", method.getName());
assertNull(ClassUtils.getMethodIfAvailable(Collection.class, "remove", null)); assertNull(ClassUtils.getMethodIfAvailable(Collection.class, "remove"));
assertNull(ClassUtils.getMethodIfAvailable(Collection.class, "someOtherMethod", null)); assertNull(ClassUtils.getMethodIfAvailable(Collection.class, "someOtherMethod"));
} }
public void testGetMethodCountForName() { public void testGetMethodCountForName() {