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

ggregory 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 d40798da5 [LANG-1818] Fix ClassUtils.getShortClassName(Class) to 
correctly handle $ in valid class names #1591
d40798da5 is described below

commit d40798da5984e49b56efff6b86700edadd1136bf
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Jan 28 15:36:52 2026 -0500

    [LANG-1818] Fix ClassUtils.getShortClassName(Class) to correctly handle
    $ in valid class names #1591
    
    - Javadoc
    - Sort class name
    - Sort new members
---
 src/changes/changes.xml                            |  1 +
 .../lang3/ClassUtilsShortClassNameTest.java        | 26 +++++++++-------------
 2 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index b20605d14..85afffa62 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -112,6 +112,7 @@ The <action> type attribute can be add,update,fix,remove.
     <action issue="LANG-1814" type="fix" dev="ggregory" due-to="Ivan 
Ponomarev">ArrayUtils.subarray(..) may overflow index arithmetic and violate 
contract for extreme index values.</action>
     <action issue="LANG-1816" type="fix" dev="ggregory" due-to="Ivan 
Ponomarev, Gary Gregory">ArrayUtils contains/indexOf/indexesOf with tolerance 
fail to match NaN values #1589.</action>
     <action                   type="fix" dev="ggregory" due-to="Ivan 
Ponomarev, Gary Gregory">Fix StringIndexOutOfBoundsException message in 
StrBuilder.append(char[], int, int).</action>
+    <action issue="LANG-1818" type="fix" dev="ggregory" due-to="Ivan 
Ponomarev, Gary Gregory">Fix ClassUtils.getShortClassName(Class) to correctly 
handle $ in valid class names #1591.</action>
     <!-- ADD -->
     <action                   type="add" dev="ggregory" due-to="Gary 
Gregory">Add JavaVersion.JAVA_27.</action>
     <action                   type="add" dev="ggregory" due-to="Gary 
Gregory">Add SystemUtils.IS_JAVA_27.</action>
diff --git 
a/src/test/java/org/apache/commons/lang3/ClassUtilsShortClassNameTest.java 
b/src/test/java/org/apache/commons/lang3/ClassUtilsShortClassNameTest.java
index d19bc0393..89282b295 100644
--- a/src/test/java/org/apache/commons/lang3/ClassUtilsShortClassNameTest.java
+++ b/src/test/java/org/apache/commons/lang3/ClassUtilsShortClassNameTest.java
@@ -22,25 +22,19 @@
 import org.junit.jupiter.api.Test;
 
 class $trange {
-
-}
-
-class Pa$$word {
-
 }
 
 /**
- * Tests for <a 
href="https://issues.apache.org/jira/browse/LANG-1818";>LANG-1818</a>
+ * Tests {@link ClassUtils#getShortClassName(Class)} for <a 
href="https://issues.apache.org/jira/browse/LANG-1818";>LANG-1818</a>
  */
 public class ClassUtilsShortClassNameTest {
 
     class $Inner {
-
     }
 
     class Inner {
-        class Ne$ted {
 
+        class Ne$ted {
         }
     }
 
@@ -55,20 +49,20 @@ void testDollarSignWithinName() {
     }
 
     @Test
-    void testMultipleDollarSigns() {
-        assertEquals(getClass().getSimpleName() + ".$Inner",
-                ClassUtils.getShortClassName($Inner.class));
+    void testInnerClassName() {
+        assertEquals(getClass().getSimpleName() + ".Inner", 
ClassUtils.getShortClassName(Inner.class));
     }
 
     @Test
-    void testInnerClassName() {
-        assertEquals(getClass().getSimpleName() + ".Inner",
-                ClassUtils.getShortClassName(Inner.class));
+    void testMultipleDollarSigns() {
+        assertEquals(getClass().getSimpleName() + ".$Inner", 
ClassUtils.getShortClassName($Inner.class));
     }
 
     @Test
     void testNe$tedClassName() {
-        assertEquals(getClass().getSimpleName() + ".Inner.Ne$ted",
-                ClassUtils.getShortClassName(Inner.Ne$ted.class));
+        assertEquals(getClass().getSimpleName() + ".Inner.Ne$ted", 
ClassUtils.getShortClassName(Inner.Ne$ted.class));
     }
 }
+
+class Pa$$word {
+}

Reply via email to