Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/java.base/share/classes/java/util/AbstractCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import org.checkerframework.checker.index.qual.NonNegative;
import org.checkerframework.checker.index.qual.PolyGrowShrink;
import org.checkerframework.checker.index.qual.Shrinkable;
import org.checkerframework.checker.index.qual.CanShrink;
import org.checkerframework.checker.lock.qual.GuardSatisfied;
import org.checkerframework.checker.nonempty.qual.EnsuresNonEmptyIf;
import org.checkerframework.checker.nonempty.qual.PolyNonEmpty;
Expand Down Expand Up @@ -296,7 +296,7 @@ public boolean add(@GuardSatisfied AbstractCollection<E> this, E e) {
* @throws ClassCastException {@inheritDoc}
* @throws NullPointerException {@inheritDoc}
*/
public boolean remove(@GuardSatisfied @Shrinkable AbstractCollection<E> this, @GuardSatisfied @UnknownSignedness Object o) {
public boolean remove(@GuardSatisfied @CanShrink AbstractCollection<E> this, @GuardSatisfied @UnknownSignedness Object o) {
Iterator<E> it = iterator();
if (o==null) {
while (it.hasNext()) {
Expand Down Expand Up @@ -389,7 +389,7 @@ public boolean addAll(@GuardSatisfied AbstractCollection<E> this, Collection<? e
* @see #remove(Object)
* @see #contains(Object)
*/
public boolean removeAll(@GuardSatisfied @Shrinkable AbstractCollection<E> this, Collection<? extends @UnknownSignedness Object> c) {
public boolean removeAll(@GuardSatisfied @CanShrink AbstractCollection<E> this, Collection<? extends @UnknownSignedness Object> c) {
Objects.requireNonNull(c);
boolean modified = false;
Iterator<?> it = iterator();
Expand Down Expand Up @@ -424,7 +424,7 @@ public boolean removeAll(@GuardSatisfied @Shrinkable AbstractCollection<E> this,
* @see #remove(Object)
* @see #contains(Object)
*/
public boolean retainAll(@GuardSatisfied @Shrinkable AbstractCollection<E> this, Collection<? extends @UnknownSignedness Object> c) {
public boolean retainAll(@GuardSatisfied @CanShrink AbstractCollection<E> this, Collection<? extends @UnknownSignedness Object> c) {
Objects.requireNonNull(c);
boolean modified = false;
Iterator<E> it = iterator();
Expand Down Expand Up @@ -453,7 +453,7 @@ public boolean retainAll(@GuardSatisfied @Shrinkable AbstractCollection<E> this,
*
* @throws UnsupportedOperationException {@inheritDoc}
*/
public void clear(@GuardSatisfied @Shrinkable AbstractCollection<E> this) {
public void clear(@GuardSatisfied @CanShrink AbstractCollection<E> this) {
Iterator<E> it = iterator();
while (it.hasNext()) {
it.next();
Expand Down
8 changes: 4 additions & 4 deletions src/java.base/share/classes/java/util/AbstractList.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.checkerframework.checker.index.qual.IndexFor;
import org.checkerframework.checker.index.qual.IndexOrHigh;
import org.checkerframework.checker.index.qual.PolyGrowShrink;
import org.checkerframework.checker.index.qual.Shrinkable;
import org.checkerframework.checker.index.qual.CanShrink;
import org.checkerframework.checker.lock.qual.GuardSatisfied;
import org.checkerframework.checker.nonempty.qual.EnsuresNonEmpty;
import org.checkerframework.checker.nonempty.qual.EnsuresNonEmptyIf;
Expand Down Expand Up @@ -187,7 +187,7 @@ public void add(@GuardSatisfied AbstractList<E> this, @IndexOrHigh({"this"}) int
* @throws UnsupportedOperationException {@inheritDoc}
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
public E remove(@GuardSatisfied @Shrinkable AbstractList<E> this, @IndexFor({"this"}) int index) {
public E remove(@GuardSatisfied @CanShrink AbstractList<E> this, @IndexFor({"this"}) int index) {
throw new UnsupportedOperationException();
}

Expand Down Expand Up @@ -265,7 +265,7 @@ public E remove(@GuardSatisfied @Shrinkable AbstractList<E> this, @IndexFor({"th
* @throws UnsupportedOperationException if the {@code clear} operation
* is not supported by this list
*/
public void clear(@GuardSatisfied @Shrinkable AbstractList<E> this) {
public void clear(@GuardSatisfied @CanShrink AbstractList<E> this) {
removeRange(0, size());
}

Expand Down Expand Up @@ -623,7 +623,7 @@ public int hashCode(@GuardSatisfied AbstractList<E> this) {
* @param fromIndex index of first element to be removed
* @param toIndex index after last element to be removed
*/
protected void removeRange(@GuardSatisfied @Shrinkable AbstractList<E> this, @IndexOrHigh({"this"}) int fromIndex, @IndexOrHigh({"this"}) int toIndex) {
protected void removeRange(@GuardSatisfied @CanShrink AbstractList<E> this, @IndexOrHigh({"this"}) int fromIndex, @IndexOrHigh({"this"}) int toIndex) {
ListIterator<E> it = listIterator(fromIndex);
for (int i=0, n=toIndex-fromIndex; i<n; i++) {
it.next();
Expand Down
6 changes: 3 additions & 3 deletions src/java.base/share/classes/java/util/AbstractQueue.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

package java.util;

import org.checkerframework.checker.index.qual.Shrinkable;
import org.checkerframework.checker.index.qual.CanShrink;
import org.checkerframework.checker.lock.qual.GuardSatisfied;
import org.checkerframework.checker.nonempty.qual.EnsuresNonEmpty;
import org.checkerframework.checker.nonempty.qual.NonEmpty;
Expand Down Expand Up @@ -117,7 +117,7 @@ public boolean add(@GuardSatisfied AbstractQueue<E> this, E e) {
* @return the head of this queue
* @throws NoSuchElementException if this queue is empty
*/
public E remove(@GuardSatisfied @NonEmpty @Shrinkable AbstractQueue<E> this) {
public E remove(@GuardSatisfied @NonEmpty @CanShrink AbstractQueue<E> this) {
E x = poll();
if (x != null)
return x;
Expand Down Expand Up @@ -151,7 +151,7 @@ public E element(@GuardSatisfied @NonEmpty AbstractQueue<E> this) {
* <p>This implementation repeatedly invokes {@link #poll poll} until it
* returns {@code null}.
*/
public void clear(@GuardSatisfied @Shrinkable AbstractQueue<E> this) {
public void clear(@GuardSatisfied @CanShrink AbstractQueue<E> this) {
while (poll() != null)
;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
package java.util;

import org.checkerframework.checker.index.qual.PolyGrowShrink;
import org.checkerframework.checker.index.qual.Shrinkable;
import org.checkerframework.checker.index.qual.CanShrink;
import org.checkerframework.checker.lock.qual.GuardSatisfied;
import org.checkerframework.checker.nonempty.qual.PolyNonEmpty;
import org.checkerframework.dataflow.qual.Pure;
Expand Down Expand Up @@ -180,7 +180,7 @@ public void add(@GuardSatisfied AbstractSequentialList<E> this, int index, E ele
* @throws UnsupportedOperationException {@inheritDoc}
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
public E remove(@GuardSatisfied @Shrinkable AbstractSequentialList<E> this, int index) {
public E remove(@GuardSatisfied @CanShrink AbstractSequentialList<E> this, int index) {
try {
ListIterator<E> e = listIterator(index);
E outCast = e.next();
Expand Down
30 changes: 15 additions & 15 deletions src/java.base/share/classes/java/util/ArrayDeque.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

import org.checkerframework.checker.index.qual.NonNegative;
import org.checkerframework.checker.index.qual.PolyGrowShrink;
import org.checkerframework.checker.index.qual.Shrinkable;
import org.checkerframework.checker.index.qual.CanShrink;
import org.checkerframework.checker.lock.qual.GuardSatisfied;
import org.checkerframework.checker.nonempty.qual.EnsuresNonEmpty;
import org.checkerframework.checker.nonempty.qual.EnsuresNonEmptyIf;
Expand Down Expand Up @@ -375,7 +375,7 @@ public boolean offerLast(E e) {
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E removeFirst(@GuardSatisfied @NonEmpty @Shrinkable ArrayDeque<E> this) {
public E removeFirst(@GuardSatisfied @NonEmpty @CanShrink ArrayDeque<E> this) {
E e = pollFirst();
if (e == null)
throw new NoSuchElementException();
Expand All @@ -385,14 +385,14 @@ public E removeFirst(@GuardSatisfied @NonEmpty @Shrinkable ArrayDeque<E> this) {
/**
* @throws NoSuchElementException {@inheritDoc}
*/
public E removeLast(@GuardSatisfied @NonEmpty @Shrinkable ArrayDeque<E> this) {
public E removeLast(@GuardSatisfied @NonEmpty @CanShrink ArrayDeque<E> this) {
E e = pollLast();
if (e == null)
throw new NoSuchElementException();
return e;
}

public @Nullable E pollFirst(@GuardSatisfied @Shrinkable ArrayDeque<E> this) {
public @Nullable E pollFirst(@GuardSatisfied @CanShrink ArrayDeque<E> this) {
final Object[] es;
final int h;
E e = elementAt(es = elements, h = head);
Expand All @@ -403,7 +403,7 @@ public E removeLast(@GuardSatisfied @NonEmpty @Shrinkable ArrayDeque<E> this) {
return e;
}

public @Nullable E pollLast(@GuardSatisfied @Shrinkable ArrayDeque<E> this) {
public @Nullable E pollLast(@GuardSatisfied @CanShrink ArrayDeque<E> this) {
final Object[] es;
final int t;
E e = elementAt(es = elements, t = dec(tail, es.length));
Expand Down Expand Up @@ -456,7 +456,7 @@ public E getLast(@GuardSatisfied @NonEmpty ArrayDeque<E> this) {
* @param o element to be removed from this deque, if present
* @return {@code true} if the deque contained the specified element
*/
public boolean removeFirstOccurrence(@GuardSatisfied @Shrinkable ArrayDeque<E> this, @GuardSatisfied @Nullable @UnknownSignedness Object o) {
public boolean removeFirstOccurrence(@GuardSatisfied @CanShrink ArrayDeque<E> this, @GuardSatisfied @Nullable @UnknownSignedness Object o) {
if (o != null) {
final Object[] es = elements;
for (int i = head, end = tail, to = (i <= end) ? end : es.length;
Expand Down Expand Up @@ -484,7 +484,7 @@ public boolean removeFirstOccurrence(@GuardSatisfied @Shrinkable ArrayDeque<E> t
* @param o element to be removed from this deque, if present
* @return {@code true} if the deque contained the specified element
*/
public boolean removeLastOccurrence(@GuardSatisfied @Shrinkable ArrayDeque<E> this, @GuardSatisfied @Nullable @UnknownSignedness Object o) {
public boolean removeLastOccurrence(@GuardSatisfied @CanShrink ArrayDeque<E> this, @GuardSatisfied @Nullable @UnknownSignedness Object o) {
if (o != null) {
final Object[] es = elements;
for (int i = tail, end = head, to = (i >= end) ? end : 0;
Expand Down Expand Up @@ -541,7 +541,7 @@ public boolean offer(@GuardSatisfied ArrayDeque<E> this, E e) {
* @return the head of the queue represented by this deque
* @throws NoSuchElementException {@inheritDoc}
*/
public E remove(@GuardSatisfied @NonEmpty @Shrinkable ArrayDeque<E> this) {
public E remove(@GuardSatisfied @NonEmpty @CanShrink ArrayDeque<E> this) {
return removeFirst();
}

Expand All @@ -555,7 +555,7 @@ public E remove(@GuardSatisfied @NonEmpty @Shrinkable ArrayDeque<E> this) {
* @return the head of the queue represented by this deque, or
* {@code null} if this deque is empty
*/
public @Nullable E poll(@GuardSatisfied @Shrinkable ArrayDeque<E> this) {
public @Nullable E poll(@GuardSatisfied @CanShrink ArrayDeque<E> this) {
return pollFirst();
}

Expand Down Expand Up @@ -612,7 +612,7 @@ public void push(@GuardSatisfied ArrayDeque<E> this, E e) {
* of the stack represented by this deque)
* @throws NoSuchElementException {@inheritDoc}
*/
public E pop(@GuardSatisfied @NonEmpty @Shrinkable ArrayDeque<E> this) {
public E pop(@GuardSatisfied @NonEmpty @CanShrink ArrayDeque<E> this) {
return removeFirst();
}

Expand Down Expand Up @@ -926,23 +926,23 @@ public void forEach(Consumer<? super E> action) {
/**
* @throws NullPointerException {@inheritDoc}
*/
public boolean removeIf(@Shrinkable ArrayDeque<E> this, Predicate<? super E> filter) {
public boolean removeIf(@CanShrink ArrayDeque<E> this, Predicate<? super E> filter) {
Objects.requireNonNull(filter);
return bulkRemove(filter);
}

/**
* @throws NullPointerException {@inheritDoc}
*/
public boolean removeAll(@Shrinkable ArrayDeque<E> this, Collection<? extends @UnknownSignedness Object> c) {
public boolean removeAll(@CanShrink ArrayDeque<E> this, Collection<? extends @UnknownSignedness Object> c) {
Objects.requireNonNull(c);
return bulkRemove(e -> c.contains(e));
}

/**
* @throws NullPointerException {@inheritDoc}
*/
public boolean retainAll(@GuardSatisfied @Shrinkable ArrayDeque<E> this, Collection<? extends @UnknownSignedness Object> c) {
public boolean retainAll(@GuardSatisfied @CanShrink ArrayDeque<E> this, Collection<? extends @UnknownSignedness Object> c) {
Objects.requireNonNull(c);
return bulkRemove(e -> !c.contains(e));
}
Expand Down Expand Up @@ -1058,15 +1058,15 @@ public boolean contains(@GuardSatisfied ArrayDeque<E> this, @GuardSatisfied @Nul
* @param o element to be removed from this deque, if present
* @return {@code true} if this deque contained the specified element
*/
public boolean remove(@GuardSatisfied @Shrinkable ArrayDeque<E> this, @GuardSatisfied @Nullable @UnknownSignedness Object o) {
public boolean remove(@GuardSatisfied @CanShrink ArrayDeque<E> this, @GuardSatisfied @Nullable @UnknownSignedness Object o) {
return removeFirstOccurrence(o);
}

/**
* Removes all of the elements from this deque.
* The deque will be empty after this call returns.
*/
public void clear(@GuardSatisfied @Shrinkable ArrayDeque<E> this) {
public void clear(@GuardSatisfied @CanShrink ArrayDeque<E> this) {
circularClear(elements, head, tail);
head = tail = 0;
}
Expand Down
18 changes: 9 additions & 9 deletions src/java.base/share/classes/java/util/ArrayList.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.checkerframework.checker.index.qual.GTENegativeOne;
import org.checkerframework.checker.index.qual.NonNegative;
import org.checkerframework.checker.index.qual.PolyGrowShrink;
import org.checkerframework.checker.index.qual.Shrinkable;
import org.checkerframework.checker.index.qual.CanShrink;
import org.checkerframework.checker.lock.qual.GuardSatisfied;
import org.checkerframework.checker.nonempty.qual.EnsuresNonEmpty;
import org.checkerframework.checker.nonempty.qual.EnsuresNonEmptyIf;
Expand Down Expand Up @@ -584,7 +584,7 @@ public void addLast(E element) {
* @return the element that was removed from the list
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
public E remove(@GuardSatisfied @Shrinkable ArrayList<E> this, @NonNegative int index) {
public E remove(@GuardSatisfied @CanShrink ArrayList<E> this, @NonNegative int index) {
Objects.checkIndex(index, size);
final Object[] es = elementData;

Expand Down Expand Up @@ -731,7 +731,7 @@ int hashCodeRange(int from, int to) {
* @param o element to be removed from this list, if present
* @return {@code true} if this list contained the specified element
*/
public boolean remove(@GuardSatisfied @Shrinkable ArrayList<E> this, @GuardSatisfied @Nullable @UnknownSignedness Object o) {
public boolean remove(@GuardSatisfied @CanShrink ArrayList<E> this, @GuardSatisfied @Nullable @UnknownSignedness Object o) {
final Object[] es = elementData;
final int size = this.size;
int i = 0;
Expand Down Expand Up @@ -767,7 +767,7 @@ private void fastRemove(Object[] es, int i) {
* Removes all of the elements from this list. The list will
* be empty after this call returns.
*/
public void clear(@GuardSatisfied @Shrinkable ArrayList<E> this) {
public void clear(@GuardSatisfied @CanShrink ArrayList<E> this) {
modCount++;
final Object[] es = elementData;
for (int to = size, i = size = 0; i < to; i++)
Expand Down Expand Up @@ -853,7 +853,7 @@ public boolean addAll(@GuardSatisfied ArrayList<E> this, @NonNegative int index,
* toIndex > size() ||
* toIndex < fromIndex})
*/
protected void removeRange(@GuardSatisfied @Shrinkable ArrayList<E> this, int fromIndex, int toIndex) {
protected void removeRange(@GuardSatisfied @CanShrink ArrayList<E> this, int fromIndex, int toIndex) {
if (fromIndex > toIndex) {
throw new IndexOutOfBoundsException(
outOfBoundsMsg(fromIndex, toIndex));
Expand Down Expand Up @@ -908,7 +908,7 @@ private static String outOfBoundsMsg(int fromIndex, int toIndex) {
* or if the specified collection is null
* @see Collection#contains(Object)
*/
public boolean removeAll(@Shrinkable ArrayList<E> this, Collection<? extends @UnknownSignedness Object> c) {
public boolean removeAll(@CanShrink ArrayList<E> this, Collection<? extends @UnknownSignedness Object> c) {
return batchRemove(c, false, 0, size);
}

Expand All @@ -928,7 +928,7 @@ public boolean removeAll(@Shrinkable ArrayList<E> this, Collection<? extends @Un
* or if the specified collection is null
* @see Collection#contains(Object)
*/
public boolean retainAll(@GuardSatisfied @Shrinkable ArrayList<E> this, Collection<? extends @UnknownSignedness Object> c) {
public boolean retainAll(@GuardSatisfied @CanShrink ArrayList<E> this, Collection<? extends @UnknownSignedness Object> c) {
return batchRemove(c, true, 0, size);
}

Expand Down Expand Up @@ -1789,15 +1789,15 @@ private static boolean isClear(long[] bits, int i) {
* @throws NullPointerException {@inheritDoc}
*/
@Override
public boolean removeIf(@Shrinkable ArrayList<E> this, Predicate<? super E> filter) {
public boolean removeIf(@CanShrink ArrayList<E> this, Predicate<? super E> filter) {
return removeIf(filter, 0, size);
}

/**
* Removes all elements satisfying the given predicate, from index
* i (inclusive) to index end (exclusive).
*/
boolean removeIf(@Shrinkable ArrayList<E> this, Predicate<? super E> filter, int i, final int end) {
boolean removeIf(@CanShrink ArrayList<E> this, Predicate<? super E> filter, int i, final int end) {
Objects.requireNonNull(filter);
int expectedModCount = modCount;
final Object[] es = elementData;
Expand Down
Loading
Loading