diff options
author | Jonathan Nieder <jrn@google.com> | 2019-03-22 09:44:27 -0700 |
---|---|---|
committer | Jonathan Nieder <jrn@google.com> | 2019-03-22 09:45:05 -0700 |
commit | cc714d3bbb23d62d3c3239b69bc81a349b2c4c43 (patch) | |
tree | 769491354191bf7d998e24c064bbccd7161df996 /org.eclipse.jgit | |
parent | 3551e443fc0a2a587911ee88ed905501cad8e59b (diff) | |
download | jgit-cc714d3bbb23d62d3c3239b69bc81a349b2c4c43.tar.gz jgit-cc714d3bbb23d62d3c3239b69bc81a349b2c4c43.zip |
Use Objects.requireNonNull instead of a custom helper
This simplifies the API surface and makes JGit internals into less of
a custom Java dialect.
Change-Id: Idbb7d4d1037c5336341088385b8e0a59c8b4c952
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/Git.java | 4 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java | 24 |
2 files changed, 2 insertions, 26 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/Git.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/Git.java index 604cf1ee16..835e7b5fd2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/Git.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/Git.java @@ -43,7 +43,7 @@ */ package org.eclipse.jgit.api; -import static org.eclipse.jgit.lib.Constants.checkNotNull; +import static java.util.Objects.requireNonNull; import java.io.File; import java.io.IOException; @@ -222,7 +222,7 @@ public class Git implements AutoCloseable { } Git(Repository repo, boolean closeRepo) { - this.repo = checkNotNull(repo); + this.repo = requireNonNull(repo); this.closeRepo = closeRepo; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java index e724c1525c..8f4468eef2 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Constants.java @@ -466,30 +466,6 @@ public final class Constants { public static final String ATTR_BUILTIN_BINARY_MERGER = "binary"; //$NON-NLS-1$ /** - * Null checker for a {@code @NonNull} parameter. - * - * <p>This is a briefer equivalent to - * <pre> - * if (arg == null) { - * throw new NullPointerException(); - * } - * </pre> - * with the added benefit that it does not trigger nullness warnings when - * {@code arg} is declared as {@code @NonNull}. - * - * @param arg a non-null object reference - * @return arg - * @throws NullPointerException if {@code arg} is null - * @since 5.4 - */ - public static <T> T checkNotNull(T arg) { - if (arg == null) { - throw new NullPointerException(); - } - return arg; - } - - /** * Create a new digest function for objects. * * @return a new digest object. |