alhudz commented on code in PR #1818:
URL: https://github.com/apache/commons-lang/pull/1818#discussion_r4280218167


##########
src/test/java/org/apache/commons/lang3/ClassUtilsTest.java:
##########
@@ -1633,4 +1633,24 @@ void testWrapperToPrimitiveNoWrapper() {
     void testWrapperToPrimitiveNull() {
         assertNull(ClassUtils.wrapperToPrimitive(null), "Wrong result for null 
class");
     }
+
+    @Test
+    void test_getShortClassName_Class_nestedInAnonymousOrLocalClass() {
+        // The declaring class chain of a member class nested in an anonymous 
or local class cannot
+        // see past the anonymous/local enclosure, so the name-based form must 
be used for the whole
+        // chain, matching getShortClassName(Class.getName()).
+        final Class<?> memberOfAnonymous = new Object() {
+            class Inner {
+                // empty
+            }
+        }.getClass().getDeclaredClasses()[0];

Review Comment:
   The test moved to `ClassUtilsShortClassNameTest`. It now gets the member 
class through a `Supplier` returning `Inner.class`, so it no longer relies on 
`getDeclaredClasses()` order.



-- 
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