Prefer requireNonNull from Java API over Guava's checkNotNull

Most replacements are a trivial one-to-one replacement of the call to
checkNotNull with requireNonNull, however there are some calls that
make use of checkNotNull's variable argument list and formatting
parameters. Replace these with String.format wrapped in a supplier.

Using the Java API rather than Guava means we can get rid of the
custom implementation, and Edwin's TODO, in AccessSection.

Change-Id: I1d4a6b342e3544abdbba4f05ac4308d223b6768b
This commit is contained in:
David Pursehouse
2018-10-16 11:17:28 +09:00
parent d01e5b2312
commit e1e0ae5157
142 changed files with 487 additions and 472 deletions

View File

@@ -14,7 +14,7 @@
package com.google.gerrit.server.plugincontext;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.Objects.requireNonNull;
import com.google.gerrit.extensions.registration.DynamicSet;
import com.google.gerrit.extensions.registration.Extension;
@@ -85,7 +85,7 @@ public class PluginSetEntryContext<T> {
private final PluginMetrics pluginMetrics;
PluginSetEntryContext(Extension<T> extension, PluginMetrics pluginMetrics) {
this.extension = checkNotNull(extension);
this.extension = requireNonNull(extension);
this.pluginMetrics = pluginMetrics;
}