Skip to content

Commit

Permalink
Roll back suppressions for bogus nullness errors now that we've fixed…
Browse files Browse the repository at this point in the history
… our checker.

PiperOrigin-RevId: 650420998
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Jul 9, 2024
1 parent 542e588 commit c94072c
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class CompactHashSet<E extends @Nullable Object> extends AbstractSet<E> implemen
* @return a new {@code CompactHashSet} containing those elements (minus duplicates)
*/
@SafeVarargs
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public static <E extends @Nullable Object> CompactHashSet<E> create(E... elements) {
CompactHashSet<E> set = createWithExpectedSize(elements.length);
Collections.addAll(set, elements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class CompactLinkedHashSet<E extends @Nullable Object> extends CompactHashSet<E>
* @return a new {@code CompactLinkedHashSet} containing those elements (minus duplicates)
*/
@SafeVarargs
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public static <E extends @Nullable Object> CompactLinkedHashSet<E> create(E... elements) {
CompactLinkedHashSet<E> set = createWithExpectedSize(elements.length);
Collections.addAll(set, elements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,6 @@ private static <K, V> ImmutableSortedMap<K, V> fromEntries(
return fromEntries(comparator, sameComparator, entryArray, entryArray.length);
}

@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
private static <K, V> ImmutableSortedMap<K, V> fromEntries(
final Comparator<? super K> comparator,
boolean sameComparator,
Expand Down
1 change: 0 additions & 1 deletion android/guava/src/com/google/common/collect/Lists.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ private Lists() {}
*/
@SafeVarargs
@GwtCompatible(serializable = true)
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public static <E extends @Nullable Object> ArrayList<E> newArrayList(E... elements) {
checkNotNull(elements); // for GWT
// Avoid integer overflow when a large array is passed in
Expand Down
2 changes: 0 additions & 2 deletions android/guava/src/com/google/common/collect/Ordering.java
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,6 @@ public <E extends T> E max(
* @throws IllegalArgumentException if {@code k} is negative
* @since 8.0
*/
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public <E extends T> List<E> leastOf(Iterable<E> iterable, int k) {
if (iterable instanceof Collection) {
Collection<E> collection = (Collection<E>) iterable;
Expand Down Expand Up @@ -864,7 +863,6 @@ public <E extends T> List<E> greatestOf(Iterator<E> iterator, int k) {
* calling {@link Collections#sort(List)}.
*/
// TODO(kevinb): rerun benchmarks including new options
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public <E extends T> List<E> sortedCopy(Iterable<E> elements) {
@SuppressWarnings("unchecked") // does not escape, and contains only E's
E[] array = (E[]) Iterables.toArray(elements);
Expand Down
1 change: 0 additions & 1 deletion android/guava/src/com/google/common/collect/Sets.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ public static <E extends Enum<E>> EnumSet<E> newEnumSet(
* asList}{@code (...))}, or for creating an empty set then calling {@link Collections#addAll}.
* This method is not actually very useful and will likely be deprecated in the future.
*/
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public static <E extends @Nullable Object> HashSet<E> newHashSet(E... elements) {
HashSet<E> set = newHashSetWithExpectedSize(elements.length);
Collections.addAll(set, elements);
Expand Down
2 changes: 0 additions & 2 deletions android/guava/src/com/google/common/collect/TopKSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ public void offer(@ParametricNullness T elem) {
* Quickselects the top k elements from the 2k elements in the buffer. O(k) expected time, O(k log
* k) worst case.
*/
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
private void trim() {
int left = 0;
int right = 2 * k - 1;
Expand Down Expand Up @@ -273,7 +272,6 @@ public void offerAll(Iterator<? extends T> elements) {
* <p>The returned list is an unmodifiable copy and will not be affected by further changes to
* this {@code TopKSelector}. This method returns in O(k log k) time.
*/
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public List<T> topK() {
@SuppressWarnings("nullness") // safe because we pass sort() a range that contains real Ts
T[] castBuffer = (T[]) buffer;
Expand Down
1 change: 0 additions & 1 deletion guava/src/com/google/common/collect/CompactHashSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ class CompactHashSet<E extends @Nullable Object> extends AbstractSet<E> implemen
* @return a new {@code CompactHashSet} containing those elements (minus duplicates)
*/
@SafeVarargs
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public static <E extends @Nullable Object> CompactHashSet<E> create(E... elements) {
CompactHashSet<E> set = createWithExpectedSize(elements.length);
Collections.addAll(set, elements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class CompactLinkedHashSet<E extends @Nullable Object> extends CompactHashSet<E>
* @return a new {@code CompactLinkedHashSet} containing those elements (minus duplicates)
*/
@SafeVarargs
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public static <E extends @Nullable Object> CompactLinkedHashSet<E> create(E... elements) {
CompactLinkedHashSet<E> set = createWithExpectedSize(elements.length);
Collections.addAll(set, elements);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@ private static <K, V> ImmutableSortedMap<K, V> fromEntries(
return fromEntries(comparator, sameComparator, entryArray, entryArray.length);
}

@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
private static <K, V> ImmutableSortedMap<K, V> fromEntries(
final Comparator<? super K> comparator,
boolean sameComparator,
Expand Down
1 change: 0 additions & 1 deletion guava/src/com/google/common/collect/Lists.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ private Lists() {}
*/
@SafeVarargs
@GwtCompatible(serializable = true)
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public static <E extends @Nullable Object> ArrayList<E> newArrayList(E... elements) {
checkNotNull(elements); // for GWT
// Avoid integer overflow when a large array is passed in
Expand Down
2 changes: 0 additions & 2 deletions guava/src/com/google/common/collect/Ordering.java
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,6 @@ public <E extends T> E max(
* @throws IllegalArgumentException if {@code k} is negative
* @since 8.0
*/
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public <E extends T> List<E> leastOf(Iterable<E> iterable, int k) {
if (iterable instanceof Collection) {
Collection<E> collection = (Collection<E>) iterable;
Expand Down Expand Up @@ -864,7 +863,6 @@ public <E extends T> List<E> greatestOf(Iterator<E> iterator, int k) {
* calling {@link Collections#sort(List)}.
*/
// TODO(kevinb): rerun benchmarks including new options
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public <E extends T> List<E> sortedCopy(Iterable<E> elements) {
@SuppressWarnings("unchecked") // does not escape, and contains only E's
E[] array = (E[]) Iterables.toArray(elements);
Expand Down
1 change: 0 additions & 1 deletion guava/src/com/google/common/collect/Sets.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ public static <E extends Enum<E>> EnumSet<E> newEnumSet(
* asList}{@code (...))}, or for creating an empty set then calling {@link Collections#addAll}.
* This method is not actually very useful and will likely be deprecated in the future.
*/
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public static <E extends @Nullable Object> HashSet<E> newHashSet(E... elements) {
HashSet<E> set = newHashSetWithExpectedSize(elements.length);
Collections.addAll(set, elements);
Expand Down
2 changes: 0 additions & 2 deletions guava/src/com/google/common/collect/TopKSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ public void offer(@ParametricNullness T elem) {
* Quickselects the top k elements from the 2k elements in the buffer. O(k) expected time, O(k log
* k) worst case.
*/
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
private void trim() {
int left = 0;
int right = 2 * k - 1;
Expand Down Expand Up @@ -274,7 +273,6 @@ public void offerAll(Iterator<? extends T> elements) {
* <p>The returned list is an unmodifiable copy and will not be affected by further changes to
* this {@code TopKSelector}. This method returns in O(k log k) time.
*/
@SuppressWarnings("nullness") // TODO: b/316358623 - Remove after checker fix.
public List<T> topK() {
@SuppressWarnings("nullness") // safe because we pass sort() a range that contains real Ts
T[] castBuffer = (T[]) buffer;
Expand Down

0 comments on commit c94072c

Please sign in to comment.