[
https://issues.apache.org/jira/browse/HDDS-14057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18042196#comment-18042196
]
Tsz-wo Sze commented on HDDS-14057:
-----------------------------------
Java Objects.requireNonNull(..) is also have a better performance, easier to
use and better tool support in the sense that:
- better performance: the Supplier requireNonNull method allow lazy message
construction while the arguments in are evaluated eagerly.
- easier to use: people may misuse Guava Preconditions.checkNotNull(..): they
often use "{}" (log4j style) instead of "%s" for message construction.
- better tool support: almost all the tools (e.g. static analyzers) support
Java Objects.requireNonNull(..) but some tools may not support
Preconditions.checkNotNull(..).
> Do not use Guava Preconditions.checkNotNull(..)
> -----------------------------------------------
>
> Key: HDDS-14057
> URL: https://issues.apache.org/jira/browse/HDDS-14057
> Project: Apache Ozone
> Issue Type: Improvement
> Reporter: Tsz-wo Sze
> Priority: Major
>
> Currently, there are 496 occurrences of Guava Preconditions.checkNotNull(..).
> It is better to use Java Objects.requireNonNull(..) instead. We should file
> subtasks to fix them in order to avoid a huge code change.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]