From 71711e3cf80ad675ef4b908aef7da99f50a3a41e Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Sat, 14 Mar 2009 21:24:04 +0000 Subject: [PATCH] Remove deprecated methods git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@754522 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/lang/ObjectUtils.java | 33 +------------------ .../apache/commons/lang/ObjectUtilsTest.java | 18 ---------- 2 files changed, 1 insertion(+), 50 deletions(-) diff --git a/src/java/org/apache/commons/lang/ObjectUtils.java b/src/java/org/apache/commons/lang/ObjectUtils.java index 95adcdfb2..cac0f8fe3 100644 --- a/src/java/org/apache/commons/lang/ObjectUtils.java +++ b/src/java/org/apache/commons/lang/ObjectUtils.java @@ -35,6 +35,7 @@ import java.io.Serializable; * @since 1.0 * @version $Id$ */ +//@Immutable public class ObjectUtils { /** @@ -186,38 +187,6 @@ public class ObjectUtils { .append(Integer.toHexString(System.identityHashCode(object))); } - /** - *

Appends the toString that would be produced by Object - * if a class did not override toString itself. null - * will return null.

- * - *
-     * ObjectUtils.appendIdentityToString(*, null)            = null
-     * ObjectUtils.appendIdentityToString(null, "")           = "java.lang.String@1e23"
-     * ObjectUtils.appendIdentityToString(null, Boolean.TRUE) = "java.lang.Boolean@7fa"
-     * ObjectUtils.appendIdentityToString(buf, Boolean.TRUE)  = buf.append("java.lang.Boolean@7fa")
-     * 
- * - * @param buffer the buffer to append to, may be null - * @param object the object to create a toString for, may be null - * @return the default toString text, or null if - * null passed in - * @since 2.0 - * @deprecated The design of this method is bad - see LANG-360. Instead, use identityToString(StringBuffer, Object). - */ - public static StringBuffer appendIdentityToString(StringBuffer buffer, Object object) { - if (object == null) { - return null; - } - if (buffer == null) { - buffer = new StringBuffer(); - } - return buffer - .append(object.getClass().getName()) - .append('@') - .append(Integer.toHexString(System.identityHashCode(object))); - } - // ToString //----------------------------------------------------------------------- /** diff --git a/src/test/org/apache/commons/lang/ObjectUtilsTest.java b/src/test/org/apache/commons/lang/ObjectUtilsTest.java index bc67bcd83..630b94b52 100644 --- a/src/test/org/apache/commons/lang/ObjectUtilsTest.java +++ b/src/test/org/apache/commons/lang/ObjectUtilsTest.java @@ -158,24 +158,6 @@ public class ObjectUtilsTest extends TestCase { } } - public void testAppendIdentityToString() { - assertEquals(null, ObjectUtils.appendIdentityToString(null, null)); - assertEquals(null, ObjectUtils.appendIdentityToString(new StringBuffer(), null)); - assertEquals( - "java.lang.String@" + Integer.toHexString(System.identityHashCode(FOO)), - ObjectUtils.appendIdentityToString(null, FOO).toString()); - assertEquals( - "java.lang.String@" + Integer.toHexString(System.identityHashCode(FOO)), - ObjectUtils.appendIdentityToString(new StringBuffer(), FOO).toString()); - Integer val = new Integer(90); - assertEquals( - "java.lang.Integer@" + Integer.toHexString(System.identityHashCode(val)), - ObjectUtils.appendIdentityToString(null, val).toString()); - assertEquals( - "java.lang.Integer@" + Integer.toHexString(System.identityHashCode(val)), - ObjectUtils.appendIdentityToString(new StringBuffer(), val).toString()); - } - public void testToString_Object() { assertEquals("", ObjectUtils.toString((Object) null) ); assertEquals(Boolean.TRUE.toString(), ObjectUtils.toString(Boolean.TRUE) );