commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [Lang] ClassUtils getShortClassName != Class getSimpleName
Date Mon, 11 Apr 2011 22:43:43 GMT
On Mon, Apr 11, 2011 at 4:26 PM, Henri Yandell <flamefew@gmail.com> wrote:

> +1 to rename getShortClassName to getSimpleName; sitting on top of the
> JDK getSimpleName and providing null safety and whatever other
> features are needed (for example array encoding).
>

You must mean deprecate getShortClassName (to remove in 4.0) and add
getSimpleName. Right?

Gary


> Hen
>
> On Mon, Apr 11, 2011 at 7:18 AM, Gary Gregory <garydgregory@gmail.com>
> wrote:
> > Hi All:
> >
> > Should we deprecate ClassUtils getShortClassName in favor of Class
> > getSimpleName?
> >
> > The behavior of getShortClassName is undocumented for arrays in the
> Javadoc
> > and is different from getSimpleName.
> >
> > When I replace the guts of getShortClassName to call getSimpleName, one
> test
> > fails:
> >
> > junit.framework.ComparisonFailure: null
> > expected:<[ToStringStyleTest.]Person[name=John Q. ...> but
> > was:<[]Person[name=John Q. ...>
> >    at junit.framework.Assert.assertEquals(Assert.java:81)
> >    at junit.framework.Assert.assertEquals(Assert.java:87)
> >    at
> >
> org.apache.commons.lang3.builder.ShortPrefixToStringStyleTest.testPerson(ShortPrefixToStringStyleTest.java:86)
> >
> > For now, I've made a note in the Javdoc to consider using getSimpleName.
> >
> > --
> > Thank you,
> > Gary
> >
> > http://garygregory.wordpress.com/
> > http://garygregory.com/
> > http://people.apache.org/~ggregory/
> > http://twitter.com/GaryGregory
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
Thank you,
Gary

http://garygregory.wordpress.com/
http://garygregory.com/
http://people.apache.org/~ggregory/
http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message