commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [lang] ObjectUtils.toString(Object) should not be deprecated
Date Fri, 21 Feb 2014 14:29:44 GMT
I say leave the deprecation.

If it really turns out to be a major issue, the deprecation can always
be removed later.

Even Sun did that at least once.

On 21 February 2014 14:02, Benedikt Ritter <britter@apache.org> wrote:
> I've thought about this again. Our goal here was to remove all the methods
> that are available in Jdk7.
>
> The problem is that with Objects.toString(Object) is that it prints out
> "null" for null references, while ObjectUtils.toString(Object) returns the
> empty string. We had two choices:
> - keep ObjectUtils.toString(Object) because it provides a different fall
> back for null references
> - put the "burden" onto users to use Objects.toString(obj, "")
>
> I personally think it's better to use the standard library, even though you
> have to pass an additional parameter.
>
>
> 2014-02-21 11:36 GMT+01:00 Benedikt Ritter <britter@apache.org>:
>
>> I'm about to cut 3.3 today. Do we want to revert this change?
>>
>>
>> 2014-02-21 3:25 GMT+01:00 Gary Gregory <garydgregory@gmail.com>:
>>
>> I think you have a point.
>>>
>>> Gary
>>>
>>> -------- Original message --------
>>> From: Christoph Schneegans <Christoph@Schneegans.de>
>>> Date:02/20/2014  20:45  (GMT-05:00)
>>> To: dev@commons.apache.org
>>> Subject: [lang] ObjectUtils.toString(Object) should not be deprecated
>>>
>>> Hello there!
>>>
>>> I have been using the Commons Lang library for about two years, but this
>>> is my first post to the mailing list.
>>>
>>> Starting with release 3.2, ObjectUtils.toString(Object) was deprecated in
>>> favour of java.util.Objects.toString(Object), see
>>> <
>>> http://commons.apache.org/proper/commons-lang/javadocs/api-3.2/org/apache/commons/lang3/ObjectUtils.html
>>> >.
>>>
>>> As the Javadoc comment correctly points out, to preserve the current
>>> behavior, one cannot simply replace ObjectUtils.toString(foo) with
>>> Objects.toString(foo), but would need to call Objects.toString(foo, ""),
>>> which is less concise and less readable.
>>>
>>> I agree that other methods in ObjectUtils, namely
>>>   - toString(Object, String)
>>>   - equals(Object, Object)
>>>   - hashCode(Object)
>>>   - hashCodeMulti(Object...)
>>> are now superfluous and rightfully deprecated, but why deprecate a useful
>>> method when there is no direct substitute?
>>>
>>>
>>> Regards,
>>> Christoph
>>>
>>> --
>>> <http://schneegans.de/>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>>>
>>
>>
>> --
>> http://people.apache.org/~britter/
>> http://www.systemoutprintln.de/
>> http://twitter.com/BenediktRitter
>> http://github.com/britter
>>
>
>
>
> --
> http://people.apache.org/~britter/
> http://www.systemoutprintln.de/
> http://twitter.com/BenediktRitter
> http://github.com/britter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message