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 and fix some library models #277

Merged
merged 1 commit into from Feb 4, 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 @@ -196,6 +196,7 @@ private static class DefaultLibraryModels implements LibraryModels {
new ImmutableSetMultimap.Builder<MethodRef, Integer>()
.put(methodRef("com.google.common.base.Preconditions", "<T>checkNotNull(T)"), 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)
.put(
methodRef("org.junit.Assert", "assertNotNull(java.lang.String,java.lang.Object)"),
Expand All @@ -206,12 +207,12 @@ private static class DefaultLibraryModels implements LibraryModels {
methodRef(
"org.junit.jupiter.api.Assertions",
"assertNotNull(java.lang.Object,java.lang.String)"),
1)
0)
.put(
methodRef(
"org.junit.jupiter.api.Assertions",
"assertNotNull(java.lang.Object,java.util.function.Supplier<String>)"),
1)
"assertNotNull(java.lang.Object,java.util.function.Supplier<java.lang.String>)"),
0)
.build();

private static final ImmutableSetMultimap<MethodRef, Integer> EXPLICITLY_NULLABLE_PARAMETERS =
Expand Down
Expand Up @@ -201,17 +201,22 @@ static void immutableMapStuff() {
}
}

static void failIfNull(@Nullable Object o1, @Nullable Object o2) {
static void failIfNull(
@Nullable Object o1,
@Nullable Object o2,
@Nullable Object o3,
@Nullable Object o4,
@Nullable Object o5) {
org.junit.Assert.assertNotNull(o1);
o1.toString();
org.junit.Assert.assertNotNull("Null!", o2);
o2.toString();
org.junit.jupiter.api.Assertions.assertNotNull(o1);
o1.toString();
org.junit.jupiter.api.Assertions.assertNotNull(o2, "Null!");
o2.toString();
org.junit.jupiter.api.Assertions.assertNotNull(o2, () -> "Null!");
o2.toString();
org.junit.jupiter.api.Assertions.assertNotNull(o3);
o3.toString();
org.junit.jupiter.api.Assertions.assertNotNull(o4, "Null!");
o4.toString();
org.junit.jupiter.api.Assertions.assertNotNull(o5, () -> "Null!");
o5.toString();
}

static void nonNullParameters() {
Expand Down
Expand Up @@ -524,9 +524,11 @@ static void checkNotNull(@Nullable Object o) {
o.toString();
}

static void requireNonNull(@Nullable Object o) {
static void requireNonNull(@Nullable Object o, @Nullable Object p) {
Objects.requireNonNull(o);
o.toString();
Objects.requireNonNull(p, "should be non null");
p.toString();
}

static void isEmpty(@Nullable String s) {
Expand Down