[
https://issues.apache.org/jira/browse/LANG-1830?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maksym Korshun updated LANG-1830:
---------------------------------
Description:
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.
was:
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.
> 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
> Priority: Minor
>
> 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)