I am -1 on the first proposal, -0 on the second and +1 for using Preconditions.checkNotNull() with Objects.requireNonNull() be banned. Please see [1], [2] (quoted) and [3]:
> Projects which use com.google.common should generally avoid the use of > Objects.requireNonNull(Object) > <https://docs.oracle.com/javase/9/docs/api/java/util/Objects.html?is-external=true#requireNonNull-T->. > Instead, use whichever of checkNotNull(Object) > <https://google.github.io/guava/releases/snapshot/api/docs/com/google/common/base/Preconditions.html#checkNotNull-T-> > or Verify.verifyNotNull(Object) > <https://google.github.io/guava/releases/snapshot/api/docs/com/google/common/base/Verify.html#verifyNotNull-T-> > is appropriate to the situation. (The same goes for the message-accepting > overloads.) Thank you, Vlad [1] https://stackoverflow.com/questions/34646554/java-util-objects-requirenonnull-vs-preconditions-checknotnull <https://stackoverflow.com/questions/34646554/java-util-objects-requirenonnull-vs-preconditions-checknotnull> [2] https://google.github.io/guava/releases/snapshot/api/docs/com/google/common/base/Preconditions.html <https://google.github.io/guava/releases/snapshot/api/docs/com/google/common/base/Preconditions.html> [3] https://github.com/google/guava/wiki/PreconditionsExplained <https://github.com/google/guava/wiki/PreconditionsExplained> (the last paragraph) > On Aug 21, 2018, at 11:50, Vova Vysotskyi <vvo...@gmail.com> wrote: > > Hi all, > > I'm working on the PR-1397 <https://github.com/apache/drill/pull/1397> > for DRILL-6633, which aims to replace usage of Guava classes by JDK ones > where possible. > > One of the things I have done was replacing Preconditions.checkNotNull() by > Objects.requireNonNull(). > > I have a discussion in this PR with Vlad Rozov about the replacement > mentioned above (see our arguments in these comments > <https://github.com/apache/drill/pull/1397#discussion_r207266884>). > > So I'm wondering the opinion of the community regarding the way which > should be chosen for further development: > - Should all usages of Preconditions.checkNotNull() be replaced by > Objects.requireNonNull() and Preconditions.checkNotNull() banned? > - Should be left Preconditions.checkNotNull() and allowed usage of both > Preconditions.checkNotNull() and Objects.requireNonNull(). > > Kind regards, > Volodymyr Vysotskyi