[ 
https://issues.apache.org/jira/browse/HDDS-15908?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18097373#comment-18097373
 ] 

Attila Doroszlai commented on HDDS-15908:
-----------------------------------------

- Pair is obsoleted by [Record Classes|https://openjdk.org/jeps/395] introduced 
in Java 16.  However, Ozone currently sticks to Java 8.  We can start using 
records in server code after HDDS-14439.
- I agree that "left"/"right" are too generic.  This can be mitigated by 
subclassing Pair to add name for the properties while still inheriting 
boilerplate implementation.
- Commons Lang is also used for other purposes in Ozone, as well as its 
transitive dependencies.  So it is not an unnecessary dependency, cannot be 
removed even if we avoid using Pair.

So I suggest:
- now: create subclasses for inline Pairs to give them meaning
- later: refactor Pair subclasses to records

> Disallow using Apache Commons Pair
> ----------------------------------
>
>                 Key: HDDS-15908
>                 URL: https://issues.apache.org/jira/browse/HDDS-15908
>             Project: Apache Ozone
>          Issue Type: Improvement
>            Reporter: Tsz-wo Sze
>            Priority: Major
>         Attachments: image-2026-07-18-12-01-27-484.png
>
>
> As Google suggested:
> {quote}Using the org.apache.commons.lang3.tuple.Pair class from Apache 
> Commons Lang is generally discouraged in modern Java ...
>  - Lack of semantics ...
>  - Code smell (Primitive Obsession) ...
>  - Unnecessary dependency ....{quote}
> !image-2026-07-18-12-01-27-484.png|width=600!



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to