Skip to content

Commit

Permalink
Fix [varargs] compiler warnings
Browse files Browse the repository at this point in the history
Remove unnecessary 'null' argument from calls to vararg supported
methods and fix cast in ValidationUtils.invokeValidator().
  • Loading branch information
philwebb authored and cbeams committed Dec 28, 2012
1 parent 731d5be commit 7f0aa5c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,14 @@ public void testSecuritySanity() throws Exception {
}

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void testIsNotIgnoredDoesntIgnoreUnspecifiedBeanMethods() throws Exceptio
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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public void testGenerifiedClass() throws Exception {
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);

Expand All @@ -202,7 +202,7 @@ public void ignore_testClassesWithoutDebugSymbols() throws Exception {
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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void testClass() {
}

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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,23 +171,23 @@ public void testGetQualifiedNameForMultiDimensionalPrimitiveArrayClass() {
}

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());

method = ClassUtils.getMethodIfAvailable(Collection.class, "remove", new Class[] {Object.class});
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() {
Expand Down

0 comments on commit 7f0aa5c

Please sign in to comment.