Skip to content

Commit

Permalink
Make our nullness checking work with an Android bootclasspath.
Browse files Browse the repository at this point in the history
This involves accommodating a bug in our checker.

RELNOTES=n/a
PiperOrigin-RevId: 591381848
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Dec 15, 2023
1 parent 3e125c7 commit fde6632
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import static com.google.common.truth.Fact.fact;
import static com.google.common.truth.Fact.simpleFact;
import static com.google.common.truth.Platform.getStackTraceAsString;
import static java.util.Arrays.asList;
import static com.google.common.truth.SubjectUtils.asList;

import com.google.common.base.Function;
import com.google.common.base.Joiner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import static com.google.common.truth.IterableSubject.ElementFactGrouping.FACT_PER_ELEMENT;
import static com.google.common.truth.SubjectUtils.accumulate;
import static com.google.common.truth.SubjectUtils.annotateEmptyStrings;
import static com.google.common.truth.SubjectUtils.asList;
import static com.google.common.truth.SubjectUtils.countDuplicates;
import static com.google.common.truth.SubjectUtils.countDuplicatesAndAddTypeInfo;
import static com.google.common.truth.SubjectUtils.countDuplicatesAndMaybeAddTypeInfoReturnObject;
Expand All @@ -36,7 +37,6 @@
import static com.google.common.truth.SubjectUtils.iterableToList;
import static com.google.common.truth.SubjectUtils.objectToTypeName;
import static com.google.common.truth.SubjectUtils.retainMatchingToString;
import static java.util.Arrays.asList;

import com.google.common.base.Function;
import com.google.common.base.Objects;
Expand Down
7 changes: 6 additions & 1 deletion core/src/main/java/com/google/common/truth/SubjectUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private SubjectUtils() {}
if (rest == null) {
items.add((T) null);
} else {
items.addAll(Arrays.asList(rest));
items.addAll(asList(rest));
}
return items;
}
Expand Down Expand Up @@ -401,4 +401,9 @@ static <E> ImmutableList<E> append(ImmutableList<? extends E> list, E object) {
static <E> ImmutableList<E> sandwich(E first, E[] array, E last) {
return new ImmutableList.Builder<E>().add(first).add(array).add(last).build();
}

@SuppressWarnings("nullness") // TODO: b/316358623 - Remove suppression after fixing checker
static <E extends @Nullable Object> List<E> asList(E... a) {
return Arrays.asList(a);
}
}

0 comments on commit fde6632

Please sign in to comment.