This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git


The following commit(s) were added to refs/heads/master by this push:
     new baa862fd5 Add regression test for dollar signs in local-class member 
names
baa862fd5 is described below

commit baa862fd56639d834705c19aa7c62d2d1126a799
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Oct 14 19:32:23 2026 -0400

    Add regression test for dollar signs in local-class member names
    
    Verify that getShortClassName(Class) preserves the literal dollar sign
    in
    Inner$Name when it is a member of a local class. Check only the suffix
    to
    avoid depending on enclosing context or compiler-generated ordinals.
    
    The test passes with the current implementation and fails with the
    whole-name fallback proposed in
    https://github.com/apache/commons-lang/pull/1818.
---
 .../apache/commons/lang3/ClassUtilsShortClassNameTest.java   | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git 
a/src/test/java/org/apache/commons/lang3/ClassUtilsShortClassNameTest.java 
b/src/test/java/org/apache/commons/lang3/ClassUtilsShortClassNameTest.java
index d8cbae0b8..6454c5a38 100644
--- a/src/test/java/org/apache/commons/lang3/ClassUtilsShortClassNameTest.java
+++ b/src/test/java/org/apache/commons/lang3/ClassUtilsShortClassNameTest.java
@@ -18,6 +18,7 @@
 package org.apache.commons.lang3;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import org.junit.jupiter.api.Test;
 
@@ -43,6 +44,17 @@ void testDollarSignImmediatelyAfterPackage() {
         assertEquals("$trange", ClassUtils.getShortClassName($trange.class));
     }
 
+    @Test
+    void testDollarSignWithinMemberOfLocalClass() {
+        class Local {
+            class Inner$Name {
+            }
+        }
+        final String shortName = 
ClassUtils.getShortClassName(Local.Inner$Name.class);
+        // Check the member identifier independently of enclosing context and 
compiler-generated ordinals.
+        assertTrue(shortName.endsWith(".Inner$Name"), () -> "Member identifier 
must retain its literal dollar sign: " + shortName);
+    }
+
     @Test
     void testDollarSignWithinName() {
         assertEquals("Pa$$word", ClassUtils.getShortClassName(Pa$$word.class));

Reply via email to