[jira] [Commented] (LANG-696) Deprecate ClassUtils getShortClassName in favor of Class getSimpleName

2019-08-27 Thread Gary Gregory (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16917082#comment-16917082
 ] 

Gary Gregory commented on LANG-696:
---

It looks like you need to adjust some of the tests.

> Deprecate ClassUtils getShortClassName in favor of Class getSimpleName
> --
>
> Key: LANG-696
> URL: https://issues.apache.org/jira/browse/LANG-696
> Project: Commons Lang
>  Issue Type: New Feature
>  Components: lang.*
>Affects Versions: 2.6
>Reporter: Gary Gregory
>Assignee: Gary Gregory
>Priority: Major
> Fix For: Discussion
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Added two null-safe ClassUtils.getSimpleName() APIs.
> -- Forwarded message --
> From: Gary Gregory 
> Date: Mon, Apr 11, 2011 at 10:18 AM
> Subject: [Lang] ClassUtils getShortClassName != Class getSimpleName
> To: Commons Developers List 
> 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.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (LANG-696) Deprecate ClassUtils getShortClassName in favor of Class getSimpleName

2019-08-27 Thread Peter Verhas (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16916671#comment-16916671
 ] 

Peter Verhas commented on LANG-696:
---

I created a pull request for this issue, but not about the deprecation, rather 
extending the JavaDoc with more explanation and examples and also with some 
more explanatory unit tests.

> Deprecate ClassUtils getShortClassName in favor of Class getSimpleName
> --
>
> Key: LANG-696
> URL: https://issues.apache.org/jira/browse/LANG-696
> Project: Commons Lang
>  Issue Type: New Feature
>  Components: lang.*
>Affects Versions: 2.6
>Reporter: Gary Gregory
>Assignee: Gary Gregory
>Priority: Major
> Fix For: Discussion
>
>  Time Spent: 10m
>  Remaining Estimate: 0h
>
> Added two null-safe ClassUtils.getSimpleName() APIs.
> -- Forwarded message --
> From: Gary Gregory 
> Date: Mon, Apr 11, 2011 at 10:18 AM
> Subject: [Lang] ClassUtils getShortClassName != Class getSimpleName
> To: Commons Developers List 
> 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.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (LANG-696) Deprecate ClassUtils getShortClassName in favor of Class getSimpleName

2019-08-26 Thread Peter Verhas (Jira)


[ 
https://issues.apache.org/jira/browse/LANG-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16916016#comment-16916016
 ] 

Peter Verhas commented on LANG-696:
---

getShortClass name will return the name of the class without the package 
structure in front of that, while getSimpleName returns the name of the class 
without the packages structure AND nesting class structure. So the two are not 
the same, as the unit test clearly show when testing the two for Map.Entry. 

> Deprecate ClassUtils getShortClassName in favor of Class getSimpleName
> --
>
> Key: LANG-696
> URL: https://issues.apache.org/jira/browse/LANG-696
> Project: Commons Lang
>  Issue Type: New Feature
>  Components: lang.*
>Affects Versions: 2.6
>Reporter: Gary Gregory
>Assignee: Gary Gregory
>Priority: Major
> Fix For: Discussion
>
>
> Added two null-safe ClassUtils.getSimpleName() APIs.
> -- Forwarded message --
> From: Gary Gregory 
> Date: Mon, Apr 11, 2011 at 10:18 AM
> Subject: [Lang] ClassUtils getShortClassName != Class getSimpleName
> To: Commons Developers List 
> 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.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)


[jira] [Commented] (LANG-696) Deprecate ClassUtils getShortClassName in favor of Class getSimpleName

2012-05-17 Thread david cogen (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13277982#comment-13277982
 ] 

david cogen commented on LANG-696:
--

I do not believe it should be deprecated, and the suggestion to consider using 
Class.getSimpleName() is misleading, because there are more differences than 
the one mentioned. For example, getShortClassName() formats an anonymous class 
like klass.1 but Class.getSimpleName() formats it as .

I rely on getShortClassName()'s behavior and use it frequently.

 Deprecate ClassUtils getShortClassName in favor of Class getSimpleName
 --

 Key: LANG-696
 URL: https://issues.apache.org/jira/browse/LANG-696
 Project: Commons Lang
  Issue Type: New Feature
  Components: lang.*
Affects Versions: 2.6
Reporter: Gary D. Gregory
Assignee: Gary D. Gregory
 Fix For: 3.x


 Added two null-safe ClassUtils.getSimpleName() APIs.
 -- Forwarded message --
 From: Gary Gregory garydgreg...@gmail.com
 Date: Mon, Apr 11, 2011 at 10:18 AM
 Subject: [Lang] ClassUtils getShortClassName != Class getSimpleName
 To: Commons Developers List d...@commons.apache.org
 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira




[jira] [Commented] (LANG-696) Deprecate ClassUtils getShortClassName in favor of Class getSimpleName

2011-04-29 Thread Henri Yandell (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13026867#comment-13026867
 ] 

Henri Yandell commented on LANG-696:


I've noted the different in the getShortName javadoc.

 Deprecate ClassUtils getShortClassName in favor of Class getSimpleName
 --

 Key: LANG-696
 URL: https://issues.apache.org/jira/browse/LANG-696
 Project: Commons Lang
  Issue Type: New Feature
  Components: lang.*
Affects Versions: 2.6
Reporter: Gary D. Gregory
Assignee: Gary D. Gregory
 Fix For: 3.x


 Added two null-safe ClassUtils.getSimpleName() APIs.
 -- Forwarded message --
 From: Gary Gregory garydgreg...@gmail.com
 Date: Mon, Apr 11, 2011 at 10:18 AM
 Subject: [Lang] ClassUtils getShortClassName != Class getSimpleName
 To: Commons Developers List d...@commons.apache.org
 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (LANG-696) Deprecate ClassUtils getShortClassName in favor of Class getSimpleName

2011-04-29 Thread Joerg Schaible (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13027088#comment-13027088
 ] 

Joerg Schaible commented on LANG-696:
-

There are actually more differences looking at classes defined within a method. 
The JDK version suppresses the synthetic numbering:

{noformat}
Index: src/test/java/org/apache/commons/lang3/ClassUtilsTest.java
===
--- src/test/java/org/apache/commons/lang3/ClassUtilsTest.java  (revision 
1097888)
+++ src/test/java/org/apache/commons/lang3/ClassUtilsTest.java  (working copy)
@@ -97,6 +97,11 @@
 assertEquals(String[][], 
ClassUtils.getShortClassName(String[][].class));
 assertEquals(String[][][], 
ClassUtils.getShortClassName(String[][][].class));
 assertEquals(String[][][][], 
ClassUtils.getShortClassName(String[][][][].class));
+
+// on-the-fly types
+class Named extends Object {};
+assertEquals(ClassUtilsTest.1, ClassUtils.getShortClassName(new 
Object(){}.getClass()));
+assertEquals(ClassUtilsTest.1Named, 
ClassUtils.getShortClassName(Named.class));
 }
 
 
@@ -141,6 +146,11 @@
 assertEquals(String[][], ClassUtils.getSimpleName(String[][].class));
 assertEquals(String[][][], 
ClassUtils.getSimpleName(String[][][].class));
 assertEquals(String[][][][], 
ClassUtils.getSimpleName(String[][][][].class));
+
+// on-the-fly types
+class Named extends Object {};
+assertEquals(, ClassUtils.getSimpleName(new Object(){}.getClass()));
+assertEquals(Named, ClassUtils.getSimpleName(Named.class));
 }
 
 public void test_getSimpleName_Object() {
{noformat}

 Deprecate ClassUtils getShortClassName in favor of Class getSimpleName
 --

 Key: LANG-696
 URL: https://issues.apache.org/jira/browse/LANG-696
 Project: Commons Lang
  Issue Type: New Feature
  Components: lang.*
Affects Versions: 2.6
Reporter: Gary D. Gregory
Assignee: Gary D. Gregory
 Fix For: 3.x


 Added two null-safe ClassUtils.getSimpleName() APIs.
 -- Forwarded message --
 From: Gary Gregory garydgreg...@gmail.com
 Date: Mon, Apr 11, 2011 at 10:18 AM
 Subject: [Lang] ClassUtils getShortClassName != Class getSimpleName
 To: Commons Developers List d...@commons.apache.org
 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (LANG-696) Deprecate ClassUtils getShortClassName in favor of Class getSimpleName

2011-04-28 Thread Gary D. Gregory (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13026312#comment-13026312
 ] 

Gary D. Gregory commented on LANG-696:
--

I think 3.0 is the time to loose compatibility with 2.0 and gain 
interoperability with the JRE.

 Deprecate ClassUtils getShortClassName in favor of Class getSimpleName
 --

 Key: LANG-696
 URL: https://issues.apache.org/jira/browse/LANG-696
 Project: Commons Lang
  Issue Type: New Feature
  Components: lang.*
Affects Versions: 2.6
Reporter: Gary D. Gregory
Assignee: Gary D. Gregory
 Fix For: 3.0


 Added two null-safe ClassUtils.getSimpleName() APIs.
 -- Forwarded message --
 From: Gary Gregory garydgreg...@gmail.com
 Date: Mon, Apr 11, 2011 at 10:18 AM
 Subject: [Lang] ClassUtils getShortClassName != Class getSimpleName
 To: Commons Developers List d...@commons.apache.org
 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (LANG-696) Deprecate ClassUtils getShortClassName in favor of Class getSimpleName

2011-04-28 Thread Matt Benson (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13026341#comment-13026341
 ] 

Matt Benson commented on LANG-696:
--

+1; however I think either of Map.Entry or Map$Entry is actually more 
useful than Entry.  I propose:

* eliminate redundancy by renaming {{getShortClassName()}} to 
{{getShortName()}}, returning simple name all the way up to top-level class
* add {{getSimpleName()}} for null-safe pass-through to 
{{Class.getSimpleName()}}
* document the difference between the two, with examples
* smile


 Deprecate ClassUtils getShortClassName in favor of Class getSimpleName
 --

 Key: LANG-696
 URL: https://issues.apache.org/jira/browse/LANG-696
 Project: Commons Lang
  Issue Type: New Feature
  Components: lang.*
Affects Versions: 2.6
Reporter: Gary D. Gregory
Assignee: Gary D. Gregory
 Fix For: 3.0


 Added two null-safe ClassUtils.getSimpleName() APIs.
 -- Forwarded message --
 From: Gary Gregory garydgreg...@gmail.com
 Date: Mon, Apr 11, 2011 at 10:18 AM
 Subject: [Lang] ClassUtils getShortClassName != Class getSimpleName
 To: Commons Developers List d...@commons.apache.org
 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (LANG-696) Deprecate ClassUtils getShortClassName in favor of Class getSimpleName

2011-04-28 Thread Henri Yandell (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13026864#comment-13026864
 ] 

Henri Yandell commented on LANG-696:


So you're suggesting we have: 

  public static String getShortName(Object object, String valueIfNull) 
  public static String getShortName(Class? cls) 
  public static String getShortName(String className) 
  public static String getSimpleName(Class? cls) 
  public static String getSimpleName(Object object, String valueIfNull) 

With the difference between 'Short' and 'Simple' being Map.Entry vs Entry? We 
also use getShortName in a few places and will have to decide which method we 
wish to use. 

Given that the maintenance for the method isn't huge; I'm beginning to think we 
should punt on this for 3.0 and deal with at a later date. We can live with a 
deprecated getShortName if need be.

 Deprecate ClassUtils getShortClassName in favor of Class getSimpleName
 --

 Key: LANG-696
 URL: https://issues.apache.org/jira/browse/LANG-696
 Project: Commons Lang
  Issue Type: New Feature
  Components: lang.*
Affects Versions: 2.6
Reporter: Gary D. Gregory
Assignee: Gary D. Gregory
 Fix For: 3.0


 Added two null-safe ClassUtils.getSimpleName() APIs.
 -- Forwarded message --
 From: Gary Gregory garydgreg...@gmail.com
 Date: Mon, Apr 11, 2011 at 10:18 AM
 Subject: [Lang] ClassUtils getShortClassName != Class getSimpleName
 To: Commons Developers List d...@commons.apache.org
 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (LANG-696) Deprecate ClassUtils getShortClassName in favor of Class getSimpleName

2011-04-27 Thread Henri Yandell (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13026117#comment-13026117
 ] 

Henri Yandell commented on LANG-696:


The only issue I see is that inner classes report as only their class name in 
the new JVM code and not the surrounding class. So Entry instead of 
Map.Entry. Our old code produced Map.Entry. I see this in 5 test fails, one 
of which is your ToStringStyle fail.

We need to decide which is 'more' correct. Do we wrap the JVM method and fix 
this, or do we change our get(String) method to stop reporting the surrounding 
class.

 Deprecate ClassUtils getShortClassName in favor of Class getSimpleName
 --

 Key: LANG-696
 URL: https://issues.apache.org/jira/browse/LANG-696
 Project: Commons Lang
  Issue Type: New Feature
  Components: lang.*
Affects Versions: 2.6
Reporter: Gary D. Gregory
Assignee: Gary D. Gregory
 Fix For: 3.0


 Added two null-safe ClassUtils.getSimpleName() APIs.
 -- Forwarded message --
 From: Gary Gregory garydgreg...@gmail.com
 Date: Mon, Apr 11, 2011 at 10:18 AM
 Subject: [Lang] ClassUtils getShortClassName != Class getSimpleName
 To: Commons Developers List d...@commons.apache.org
 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (LANG-696) Deprecate ClassUtils getShortClassName in favor of Class getSimpleName

2011-04-21 Thread Gary D. Gregory (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13022784#comment-13022784
 ] 

Gary D. Gregory commented on LANG-696:
--

-- Forwarded message --
From: Henri Yandell flame...@gmail.com
Date: Mon, Apr 11, 2011 at 4:26 PM
Subject: Re: [Lang] ClassUtils getShortClassName != Class getSimpleName
To: Commons Developers List d...@commons.apache.org


+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).

Hen

 Deprecate ClassUtils getShortClassName in favor of Class getSimpleName
 --

 Key: LANG-696
 URL: https://issues.apache.org/jira/browse/LANG-696
 Project: Commons Lang
  Issue Type: New Feature
  Components: lang.*
Affects Versions: 2.6
Reporter: Gary D. Gregory
Assignee: Gary D. Gregory
 Fix For: 3.0


 Added two null-safe ClassUtils.getSimpleName() APIs.
 -- Forwarded message --
 From: Gary Gregory garydgreg...@gmail.com
 Date: Mon, Apr 11, 2011 at 10:18 AM
 Subject: [Lang] ClassUtils getShortClassName != Class getSimpleName
 To: Commons Developers List d...@commons.apache.org
 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (LANG-696) Deprecate ClassUtils getShortClassName in favor of Class getSimpleName

2011-04-21 Thread Gary D. Gregory (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13022785#comment-13022785
 ] 

Gary D. Gregory commented on LANG-696:
--

-- Forwarded message --
From: Gary Gregory garydgreg...@gmail.com
Date: Mon, Apr 11, 2011 at 6:43 PM
Subject: Re: [Lang] ClassUtils getShortClassName != Class getSimpleName
To: Commons Developers List d...@commons.apache.org
Cc: Henri Yandell flame...@gmail.com


On Mon, Apr 11, 2011 at 4:26 PM, Henri Yandell flame...@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?

 Deprecate ClassUtils getShortClassName in favor of Class getSimpleName
 --

 Key: LANG-696
 URL: https://issues.apache.org/jira/browse/LANG-696
 Project: Commons Lang
  Issue Type: New Feature
  Components: lang.*
Affects Versions: 2.6
Reporter: Gary D. Gregory
Assignee: Gary D. Gregory
 Fix For: 3.0


 Added two null-safe ClassUtils.getSimpleName() APIs.
 -- Forwarded message --
 From: Gary Gregory garydgreg...@gmail.com
 Date: Mon, Apr 11, 2011 at 10:18 AM
 Subject: [Lang] ClassUtils getShortClassName != Class getSimpleName
 To: Commons Developers List d...@commons.apache.org
 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (LANG-696) Deprecate ClassUtils getShortClassName in favor of Class getSimpleName

2011-04-21 Thread Gary D. Gregory (JIRA)

[ 
https://issues.apache.org/jira/browse/LANG-696?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13022786#comment-13022786
 ] 

Gary D. Gregory commented on LANG-696:
--

On Mon, Apr 11, 2011 at 3:43 PM, Gary Gregory garydgreg...@gmail.com wrote:
 On Mon, Apr 11, 2011 at 4:26 PM, Henri Yandell flame...@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?

Nope. Remove getShortClassName and add getSimpleName. We're not
released yet so we can (and should) still make backwards compat
changes.

Hen

 Deprecate ClassUtils getShortClassName in favor of Class getSimpleName
 --

 Key: LANG-696
 URL: https://issues.apache.org/jira/browse/LANG-696
 Project: Commons Lang
  Issue Type: New Feature
  Components: lang.*
Affects Versions: 2.6
Reporter: Gary D. Gregory
Assignee: Gary D. Gregory
 Fix For: 3.0


 Added two null-safe ClassUtils.getSimpleName() APIs.
 -- Forwarded message --
 From: Gary Gregory garydgreg...@gmail.com
 Date: Mon, Apr 11, 2011 at 10:18 AM
 Subject: [Lang] ClassUtils getShortClassName != Class getSimpleName
 To: Commons Developers List d...@commons.apache.org
 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira