Skip to content
Open
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
1 change: 1 addition & 0 deletions make/jdk/src/classes/build/tools/jigsaw/ListPackages.java
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ private static void write(PrintStream pw, Stream<String> packages) {
}

private final Set<String> packages = new HashSet<>();
@SuppressWarnings("initialization")
ListPackages(List<Path> dirs) throws IOException {
for (Path p : dirs) {
packages.addAll(list(p));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ private int mapIndex(int index) {
resolving, ifNotPresent);
}

@Override public Object[] toArray() {
@Override public Object[]! toArray() {
return toArray(new Object[size]);
}
@Override public <T> T[] toArray(T[] a) {
@Override public <T> T[]! toArray(T[]! a) {
int pad = a.length - size;
if (pad < 0) {
pad = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/java.base/share/classes/java/lang/reflect/AccessFlag.java
Original file line number Diff line number Diff line change
Expand Up @@ -802,12 +802,12 @@ private static final class AccessFlagSet extends AbstractSet<AccessFlag> {

// all mutating methods throw UnsupportedOperationException
@Override public boolean add(AccessFlag e) { throw uoe(); }
@Override public boolean addAll(Collection<? extends AccessFlag> c) { throw uoe(); }
@Override public boolean addAll(Collection<? extends AccessFlag>! c) { throw uoe(); }
@Override public void clear() { throw uoe(); }
@Override public boolean remove(Object o) { throw uoe(); }
@Override public boolean removeAll(Collection<?> c) { throw uoe(); }
@Override public boolean removeIf(Predicate<? super AccessFlag> filter) { throw uoe(); }
@Override public boolean retainAll(Collection<?> c) { throw uoe(); }
@Override public boolean removeAll(Collection<?>! c) { throw uoe(); }
@Override public boolean removeIf(Predicate<? super AccessFlag>! filter) { throw uoe(); }
@Override public boolean retainAll(Collection<?>! c) { throw uoe(); }
private static UnsupportedOperationException uoe() { return new UnsupportedOperationException(); }

private AccessFlagSet(AccessFlag[] definition, int mask) {
Expand Down
14 changes: 6 additions & 8 deletions src/java.base/share/classes/java/util/AbstractCollection.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public boolean contains(Object o) {
* return list.toArray();
* }</pre>
*/
public Object[] toArray() {
public Object[]! toArray() {
// Estimate size of array; be prepared to see more or fewer elements
Object[] r = new Object[size()];
Iterator<E> it = iterator();
Expand Down Expand Up @@ -179,7 +179,7 @@ public Object[] toArray() {
* @throws NullPointerException {@inheritDoc}
*/
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
public <T> T[]! toArray(T[]! a) {
// Estimate size of array; be prepared to see more or fewer elements
int size = size();
T[] r = a.length >= size ? a :
Expand Down Expand Up @@ -306,7 +306,7 @@ public boolean remove(Object o) {
* @throws NullPointerException {@inheritDoc}
* @see #contains(Object)
*/
public boolean containsAll(Collection<?> c) {
public boolean containsAll(Collection<?>! c) {
for (Object e : c)
if (!contains(e))
return false;
Expand All @@ -332,7 +332,7 @@ public boolean containsAll(Collection<?> c) {
*
* @see #add(Object)
*/
public boolean addAll(Collection<? extends E> c) {
public boolean addAll(Collection<? extends E>! c) {
boolean modified = false;
for (E e : c)
if (add(e))
Expand Down Expand Up @@ -362,8 +362,7 @@ public boolean addAll(Collection<? extends E> c) {
* @see #remove(Object)
* @see #contains(Object)
*/
public boolean removeAll(Collection<?> c) {
Objects.requireNonNull(c);
public boolean removeAll(Collection<?>! c) {
boolean modified = false;
Iterator<?> it = iterator();
while (it.hasNext()) {
Expand Down Expand Up @@ -397,8 +396,7 @@ public boolean removeAll(Collection<?> c) {
* @see #remove(Object)
* @see #contains(Object)
*/
public boolean retainAll(Collection<?> c) {
Objects.requireNonNull(c);
public boolean retainAll(Collection<?>! c) {
boolean modified = false;
Iterator<E> it = iterator();
while (it.hasNext()) {
Expand Down
2 changes: 1 addition & 1 deletion src/java.base/share/classes/java/util/AbstractList.java
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ protected void removeRange(int fromIndex, int toIndex) {
updateSizeAndModCount(fromIndex - toIndex);
}

public boolean addAll(Collection<? extends E> c) {
public boolean addAll(Collection<? extends E>! c) {
return addAll(size, c);
}

Expand Down
22 changes: 11 additions & 11 deletions src/java.base/share/classes/java/util/AbstractMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -890,24 +890,24 @@ static <T extends Map.Entry<?,?>> T nsee(T entry) {
abstract Collection<E> view();

public boolean add(E t) { throw uoe(); }
public boolean addAll(Collection<? extends E> c) { throw uoe(); }
public boolean addAll(Collection<? extends E>! c) { throw uoe(); }
public void clear() { view().clear(); }
public boolean contains(Object o) { return view().contains(o); }
public boolean containsAll(Collection<?> c) { return view().containsAll(c); }
public boolean containsAll(Collection<?>! c) { return view().containsAll(c); }
public void forEach(Consumer<? super E> c) { view().forEach(c); }
public boolean isEmpty() { return view().isEmpty(); }
public Iterator<E>! iterator() { return view().iterator(); }
public Stream<E> parallelStream() { return view().parallelStream(); }
public Stream<E>! parallelStream() { return view().parallelStream(); }
public boolean remove(Object o) { return view().remove(o); }
public boolean removeAll(Collection<?> c) { return view().removeAll(c); }
public boolean removeIf(Predicate<? super E> filter) { return view().removeIf(filter); }
public boolean retainAll(Collection<?> c) { return view().retainAll(c); }
public boolean removeAll(Collection<?>! c) { return view().removeAll(c); }
public boolean removeIf(Predicate<? super E>! filter) { return view().removeIf(filter); }
public boolean retainAll(Collection<?>! c) { return view().retainAll(c); }
public int size() { return view().size(); }
public Spliterator<E> spliterator() { return view().spliterator(); }
public Stream<E> stream() { return view().stream(); }
public Object[] toArray() { return view().toArray(); }
public <T> T[] toArray(IntFunction<T[]> generator) { return view().toArray(generator); }
public <T> T[] toArray(T[] a) { return view().toArray(a); }
public Spliterator<E>! spliterator() { return view().spliterator(); }
public Stream<E>! stream() { return view().stream(); }
public Object[]! toArray() { return view().toArray(); }
public <T> T[]! toArray(IntFunction<T[]>! generator) { return view().toArray(generator); }
public <T> T[]! toArray(T[]! a) { return view().toArray(a); }
public String toString() { return view().toString(); }
}

Expand Down
4 changes: 1 addition & 3 deletions src/java.base/share/classes/java/util/AbstractQueue.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,7 @@ public void clear() {
* this time due to insertion restrictions
* @see #add(Object)
*/
public boolean addAll(Collection<? extends E> c) {
if (c == null)
throw new NullPointerException();
public boolean addAll(Collection<? extends E>! c) {
if (c == this)
throw new IllegalArgumentException();
boolean modified = false;
Expand Down
3 changes: 1 addition & 2 deletions src/java.base/share/classes/java/util/AbstractSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,7 @@ public int hashCode() {
* @see #remove(Object)
* @see #contains(Object)
*/
public boolean removeAll(Collection<?> c) {
Objects.requireNonNull(c);
public boolean removeAll(Collection<?>! c) {
boolean modified = false;

if (size() > c.size()) {
Expand Down
17 changes: 7 additions & 10 deletions src/java.base/share/classes/java/util/ArrayDeque.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public void addLast(E e) {
* @throws NullPointerException if the specified collection or any
* of its elements are null
*/
public boolean addAll(Collection<? extends E> c) {
public boolean addAll(Collection<? extends E>! c) {
final int s, needed;
if ((needed = (s = size()) + c.size() + 1 - elements.length) > 0)
grow(needed);
Expand Down Expand Up @@ -791,7 +791,7 @@ public final void forEachRemaining(Consumer<? super E> action) {
* @return a {@code Spliterator} over the elements in this deque
* @since 1.8
*/
public Spliterator<E> spliterator() {
public Spliterator<E>! spliterator() {
return new DeqSpliterator();
}

Expand Down Expand Up @@ -894,24 +894,21 @@ public void forEach(Consumer<? super E> action) {
/**
* @throws NullPointerException {@inheritDoc}
*/
public boolean removeIf(Predicate<? super E> filter) {
Objects.requireNonNull(filter);
public boolean removeIf(Predicate<? super E>! filter) {
return bulkRemove(filter);
}

/**
* @throws NullPointerException {@inheritDoc}
*/
public boolean removeAll(Collection<?> c) {
Objects.requireNonNull(c);
public boolean removeAll(Collection<?>! c) {
return bulkRemove(e -> c.contains(e));
}

/**
* @throws NullPointerException {@inheritDoc}
*/
public boolean retainAll(Collection<?> c) {
Objects.requireNonNull(c);
public boolean retainAll(Collection<?>! c) {
return bulkRemove(e -> !c.contains(e));
}

Expand Down Expand Up @@ -1064,7 +1061,7 @@ private static void circularClear(Object[] es, int i, int end) {
*
* @return an array containing all of the elements in this deque
*/
public Object[] toArray() {
public Object[]! toArray() {
return toArray(Object[].class);
}

Expand Down Expand Up @@ -1122,7 +1119,7 @@ private <T> T[] toArray(Class<T[]> klazz) {
* @throws NullPointerException if the specified array is null
*/
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
public <T> T[]! toArray(T[]! a) {
final int size;
if ((size = size()) > a.length)
return toArray((Class<T[]>) a.getClass());
Expand Down
28 changes: 14 additions & 14 deletions src/java.base/share/classes/java/util/ArrayList.java
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ public Object clone() {
* @return an array containing all of the elements in this list in
* proper sequence
*/
public Object[] toArray() {
public Object[]! toArray() {
return Arrays.copyOf(elementData, size);
}

Expand Down Expand Up @@ -395,7 +395,7 @@ public Object[] toArray() {
* @throws NullPointerException if the specified array is null
*/
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
public <T> T[]! toArray(T[]! a) {
if (a.length < size)
// Make a new array of a's runtime type, but my contents:
return (T[]) Arrays.copyOf(elementData, size, a.getClass());
Expand Down Expand Up @@ -749,7 +749,7 @@ public void clear() {
* @return {@code true} if this list changed as a result of the call
* @throws NullPointerException if the specified collection is null
*/
public boolean addAll(Collection<? extends E> c) {
public boolean addAll(Collection<? extends E>! c) {
Object[] a;
int numNew;
if (c.getClass() == ArrayList.class) {
Expand Down Expand Up @@ -878,7 +878,7 @@ private static String outOfBoundsMsg(int fromIndex, int toIndex) {
* or if the specified collection is null
* @see Collection#contains(Object)
*/
public boolean removeAll(Collection<?> c) {
public boolean removeAll(Collection<?>! c) {
return batchRemove(c, false, 0, size);
}

Expand All @@ -898,7 +898,7 @@ public boolean removeAll(Collection<?> c) {
* or if the specified collection is null
* @see Collection#contains(Object)
*/
public boolean retainAll(Collection<?> c) {
public boolean retainAll(Collection<?>! c) {
return batchRemove(c, true, 0, size);
}

Expand Down Expand Up @@ -1268,7 +1268,7 @@ protected void removeRange(int fromIndex, int toIndex) {
updateSizeAndModCount(fromIndex - toIndex);
}

public boolean addAll(Collection<? extends E> c) {
public boolean addAll(Collection<? extends E>! c) {
return addAll(this.size, c);
}

Expand All @@ -1287,11 +1287,11 @@ public void replaceAll(UnaryOperator<E> operator) {
root.replaceAllRange(operator, offset, offset + size);
}

public boolean removeAll(Collection<?> c) {
public boolean removeAll(Collection<?>! c) {
return batchRemove(c, false);
}

public boolean retainAll(Collection<?> c) {
public boolean retainAll(Collection<?>! c) {
return batchRemove(c, true);
}

Expand All @@ -1305,7 +1305,7 @@ private boolean batchRemove(Collection<?> c, boolean complement) {
return modified;
}

public boolean removeIf(Predicate<? super E> filter) {
public boolean removeIf(Predicate<? super E>! filter) {
checkForComodification();
int oldSize = root.size;
boolean modified = root.removeIf(filter, offset, offset + size);
Expand All @@ -1314,13 +1314,13 @@ public boolean removeIf(Predicate<? super E> filter) {
return modified;
}

public Object[] toArray() {
public Object[]! toArray() {
checkForComodification();
return Arrays.copyOfRange(root.elementData, offset, offset + size);
}

@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
public <T> T[]! toArray(T[]! a) {
checkForComodification();
if (a.length < size)
return (T[]) Arrays.copyOfRange(
Expand Down Expand Up @@ -1515,7 +1515,7 @@ private void updateSizeAndModCount(int sizeChange) {
} while (slist != null);
}

public Spliterator<E> spliterator() {
public Spliterator<E>! spliterator() {
checkForComodification();

// This Spliterator needs to late-bind to the subList, not the outer
Expand Down Expand Up @@ -1628,7 +1628,7 @@ public void forEach(Consumer<? super E> action) {
* @since 1.8
*/
@Override
public Spliterator<E> spliterator() {
public Spliterator<E>! spliterator() {
return new ArrayListSpliterator(0, -1, 0);
}

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

Expand Down
6 changes: 3 additions & 3 deletions src/java.base/share/classes/java/util/Arrays.java
Original file line number Diff line number Diff line change
Expand Up @@ -4218,13 +4218,13 @@ public int size() {
}

@Override
public Object[] toArray() {
public Object[]! toArray() {
return Arrays.copyOf(a, a.length, Object[].class);
}

@Override
@SuppressWarnings("unchecked")
public <T> T[] toArray(T[] a) {
public <T> T[]! toArray(T[]! a) {
int size = size();
if (a.length < size)
return Arrays.copyOf(this.a, size,
Expand Down Expand Up @@ -4268,7 +4268,7 @@ public boolean contains(Object o) {
}

@Override
public Spliterator<E> spliterator() {
public Spliterator<E>! spliterator() {
return Spliterators.spliterator(a, Spliterator.ORDERED);
}

Expand Down
Loading