Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add model for Preconditions.checkNotNull(obj, message). #283

Merged
merged 1 commit into from Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -195,6 +195,10 @@ private static class DefaultLibraryModels implements LibraryModels {
private static final ImmutableSetMultimap<MethodRef, Integer> FAIL_IF_NULL_PARAMETERS =
new ImmutableSetMultimap.Builder<MethodRef, Integer>()
.put(methodRef("com.google.common.base.Preconditions", "<T>checkNotNull(T)"), 0)
.put(
methodRef(
"com.google.common.base.Preconditions", "<T>checkNotNull(T,java.lang.Object)"),
0)
.put(methodRef("java.util.Objects", "<T>requireNonNull(T)"), 0)
.put(methodRef("java.util.Objects", "<T>requireNonNull(T,java.lang.String)"), 0)
.put(methodRef("org.junit.Assert", "assertNotNull(java.lang.Object)"), 0)
Expand Down
Expand Up @@ -524,6 +524,11 @@ static void checkNotNull(@Nullable Object o) {
o.toString();
}

static void checkNotNullWithMessage(@Nullable Object o) {
Preconditions.checkNotNull(o, "should not be null");
o.toString();
}

static void requireNonNull(@Nullable Object o, @Nullable Object p) {
Objects.requireNonNull(o);
o.toString();
Expand Down