ppkarwasz commented on PR #1411:
URL: https://github.com/apache/commons-lang/pull/1411#issuecomment-3066817162
> Also, could you please advise where I can find guidelines or existing
examples to help identify the kinds of utility methods that are considered
suitable for inclusion in Commons Lang? That would really help me better align
future contributions.
Here's a refined and more structured version of your answer, keeping your
key points but improving clarity, tone, and flow:
That’s a great question — and one that @garydgregory is best positioned to
answer.
That said, here are my *two cents* based on experience:
### What Commons Lang Is For
Commons Lang was originally created to fill gaps in early JDKs — to provide
utility methods that were missing or cumbersome to implement. Classic examples
include:
* Better handling of `Date` and `Calendar`
* Utility methods for `String` (like `isBlank()`, `join()`, etc.)
* Helper functions for working with arrays
* Safer handling of `null` values
### How the JDK Has Evolved
Many of the original pain points Commons Lang addressed have since been
resolved in newer JDK versions:
* `java.time` (introduced in JDK 8) largely replaces the need for
`DateUtils`.
* Methods like `String.isBlank()` were added in JDK 11.
* Arrays are still performant, but have been largely replaced in day-to-day
code by `List` and `Stream` APIs.
* Static null checks and null-safe wrappers are less necessary now that
tools like IDEs and static analyzers offer better nullability support.
For example, this:
```java
StringUtils.isEmpty(string)
```
is now often replaced by simply ensuring `string` is non-null and writing:
```java
string.isEmpty()
```
Also, null-propagating utility methods can create maintenance burdens: if
one method returns `null` when given `null`, others in a call chain (like
`baz(bar(foo(x)))`) must do the same to avoid `NullPointerException`s — making
them harder to reason about (no `@NonNull` guarantee) and more verbose.
### In Summary
It’s getting harder to find genuinely useful additions to Commons Lang — and
that's a good thing. The JDK has improved a lot. Rather than expanding Commons
Lang with new utilities, it might be more helpful to offer guidance or
utilities to help users *migrate away from* it in favor of modern JDK APIs
where possible.
But again, for definitive inclusion guidelines or strategic direction, I’d
defer to @garydgregory or `[email protected]`.
--
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]