LANG-940: Fix deprecation warnings; found some more usages

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1557592 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benedikt Ritter 2014-01-12 18:53:16 +00:00
parent bdb68492fc
commit 10fee7abaf
3 changed files with 13 additions and 1 deletions

View File

@ -182,6 +182,7 @@ public class ObjectUtils {
* @param object2 the second object, may be {@code null}
* @return {@code false} if the values of both objects are the same
*/
@SuppressWarnings( "Deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
public static boolean notEqual(final Object object1, final Object object2) {
return ObjectUtils.equals(object1, object2) == false;
}
@ -239,7 +240,9 @@ public class ObjectUtils {
int hash = 1;
if (objects != null) {
for (final Object object : objects) {
hash = hash * 31 + ObjectUtils.hashCode(object);
@SuppressWarnings( "Deprecation" ) // ObjectUtils.hashCode(Object) has been deprecated in 3.2
int tmpHash = ObjectUtils.hashCode(object);
hash = hash * 31 + tmpHash;
}
}
return hash;

View File

@ -89,6 +89,7 @@ public class ObjectUtilsTest {
}
//-----------------------------------------------------------------------
@SuppressWarnings( "Deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
@Test
public void testEquals() {
assertTrue("ObjectUtils.equals(null, null) returned false", ObjectUtils.equals(null, null));
@ -107,6 +108,7 @@ public class ObjectUtilsTest {
assertFalse("ObjectUtils.notEqual(\"foo\", \"foo\") returned false", ObjectUtils.notEqual(FOO, FOO));
}
@SuppressWarnings( "Deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
@Test
public void testHashCode() {
assertEquals(0, ObjectUtils.hashCode(null));

View File

@ -46,6 +46,7 @@ public class StrTokenizerTest {
}
// -----------------------------------------------------------------------
@SuppressWarnings( "Deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
@Test
public void test1() {
@ -67,6 +68,7 @@ public class StrTokenizerTest {
}
@SuppressWarnings( "Deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
@Test
public void test2() {
@ -88,6 +90,7 @@ public class StrTokenizerTest {
}
@SuppressWarnings( "Deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
@Test
public void test3() {
@ -109,6 +112,7 @@ public class StrTokenizerTest {
}
@SuppressWarnings( "Deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
@Test
public void test4() {
@ -130,6 +134,7 @@ public class StrTokenizerTest {
}
@SuppressWarnings( "Deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
@Test
public void test5() {
@ -188,6 +193,7 @@ public class StrTokenizerTest {
}
@SuppressWarnings( "Deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
@Test
public void test7() {
@ -209,6 +215,7 @@ public class StrTokenizerTest {
}
@SuppressWarnings( "Deprecation" ) // ObjectUtils.equals(Object, Object) has been deprecated in 3.2
@Test
public void test8() {