Revert r113289 - varargs invocation does not work with null

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1132658 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2011-06-06 14:24:21 +00:00
parent e909357fb4
commit 114e59cc83
3 changed files with 12 additions and 16 deletions

View File

@ -301,8 +301,8 @@ public class ClassUtilsTest extends TestCase {
assertFalse(ClassUtils.isAssignable(null, array2));
assertTrue(ClassUtils.isAssignable(null, array0));
assertTrue(ClassUtils.isAssignable(array0, array0));
assertTrue(ClassUtils.isAssignable(array0, (Class<?>[]) null)); // test both types of ...
assertTrue(ClassUtils.isAssignable(array0, (Class<?>) null)); // ... varargs invocation
// assertTrue(ClassUtils.isAssignable(array0, null));
assertTrue(ClassUtils.isAssignable(array0, (Class<?>[]) null)); // explicit cast to avoid warning
assertTrue(ClassUtils.isAssignable((Class[]) null, (Class[]) null));
assertFalse(ClassUtils.isAssignable(array1, array1s));
@ -730,8 +730,8 @@ public class ClassUtilsTest extends TestCase {
public void testPrimitivesToWrappers() {
// test null
assertNull("null -> null", ClassUtils.primitivesToWrappers((Class<?>[]) null)); // test both types of ...
assertNull("null -> null", ClassUtils.primitivesToWrappers((Class<?>) null)); // ... varargs invocation
// assertNull("null -> null", ClassUtils.primitivesToWrappers(null));
assertNull("null -> null", ClassUtils.primitivesToWrappers((Class<?>[]) null)); // explicit cast to avoid warning
// test empty array
assertEquals("empty -> empty",
ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.primitivesToWrappers(ArrayUtils.EMPTY_CLASS_ARRAY));
@ -801,9 +801,8 @@ public class ClassUtilsTest extends TestCase {
}
public void testWrappersToPrimitivesNull() {
// Test both types of varargs invocation
assertNull("Wrong result for null input", ClassUtils.wrappersToPrimitives((Class<?>[]) null));
assertNull("Wrong result for null input", ClassUtils.wrappersToPrimitives((Class<?>) null));
// assertNull("Wrong result for null input", ClassUtils.wrappersToPrimitives(null));
assertNull("Wrong result for null input", ClassUtils.wrappersToPrimitives((Class<?>[]) null)); // explicit cast
}
public void testWrappersToPrimitivesEmpty() {
@ -958,9 +957,8 @@ public class ClassUtilsTest extends TestCase {
}
public void testToClass_object() {
// Test both types of varargs invocation
assertNull(ClassUtils.toClass((Object[]) null));
assertNull(ClassUtils.toClass((Object) null));
// assertNull(ClassUtils.toClass(null));
assertNull(ClassUtils.toClass((Object[]) null)); // explicit cast
assertSame(ArrayUtils.EMPTY_CLASS_ARRAY, ClassUtils.toClass(ArrayUtils.EMPTY_OBJECT_ARRAY));

View File

@ -174,9 +174,8 @@ public class StringUtilsTest extends TestCase {
}
public void testJoin_Objectarray() {
// Test both types of varargs invocation
assertEquals(null, StringUtils.join((Object[]) null));
assertEquals(null, StringUtils.join((Object) null));
// assertEquals(null, StringUtils.join(null));
assertEquals(null, StringUtils.join((Object[]) null)); // explicit cast
assertEquals("", StringUtils.join(EMPTY_ARRAY_LIST));
assertEquals("", StringUtils.join(NULL_ARRAY_LIST));
assertEquals("abc", StringUtils.join(new String[] {"a", "b", "c"}));

View File

@ -230,9 +230,8 @@ public class StringUtilsTrimEmptyTest extends TestCase {
String[] fooDots = new String[] { ".."+FOO+"..", ".."+FOO, FOO+".." };
String[] foo = new String[] { FOO, FOO, FOO };
// Test both varargs invocations
assertEquals(null, StringUtils.stripAll((String[]) null));
assertEquals(null, StringUtils.stripAll((String) null));
// assertEquals(null, StringUtils.stripAll(null));
assertEquals(null, StringUtils.stripAll((String[]) null)); // explicit cast
assertArrayEquals(empty, StringUtils.stripAll(empty));
assertArrayEquals(foo, StringUtils.stripAll(fooSpace));