Maksym Korshun created LANG-1830:
------------------------------------

             Summary: Avoid repeated regex compilation in 
ClassUtils.toCleanName()
                 Key: LANG-1830
                 URL: https://issues.apache.org/jira/browse/LANG-1830
             Project: Commons Lang
          Issue Type: Improvement
          Components: lang.*
            Reporter: Maksym Korshun


ClassUtils.toCleanName() currently validates the array suffix using
String.matches(), which recompiles the regular expression on every call.

Replace the repeated call to String.matches("(?:\\[\\])+") with a
private static final Pattern and reuse it for validation.

This reduces unnecessary regex compilation in a frequently used utility
method without changing behavior.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to