thiyagu-7 commented on code in PR #949:
URL: https://github.com/apache/commons-lang/pull/949#discussion_r972177609


##########
src/test/java/org/apache/commons/lang3/ClassUtilsTest.java:
##########
@@ -540,12 +539,11 @@ public void test_getShortCanonicalName_Object() {
         class Named {
             // empty
         }
-        // WARNING: this is fragile, implementation may change, naming is not 
guaranteed
-        assertEquals("ClassUtilsTest.9", ClassUtils.getShortCanonicalName(new 
Object() {
+        assertEquals("", ClassUtils.getShortCanonicalName(new Object() {
             // empty
         }, "<null>"));
-        assertEquals("ClassUtilsTest.9Named", 
ClassUtils.getShortCanonicalName(new Named(), "<null>"));
-        assertEquals("ClassUtilsTest.Inner", 
ClassUtils.getShortCanonicalName(new Inner(), "<null>"));
+        assertEquals("", ClassUtils.getShortCanonicalName(new Named(), 
"<null>"));

Review Comment:
   I felt the same. It is because it is a _local class_. Local classes don't 
have canonical name
   
   
https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getCanonicalName--
   > Returns null if the underlying class does not have a canonical name (i.e., 
if it is a local or anonymous class or an array whose component type does not 
have a canonical name).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to