Skip to content

Commit

Permalink
Withdraw SequencedCollection overrides from the public copy of `Imm…
Browse files Browse the repository at this point in the history
…utableSortedSet`.

As far as external users are concerned, this CL is a rollback of cl/575459262.

The problem that cl/575459262 was addressing looks like it may be a quirk of Google's internal build setup. We may end up wanting to remove these overrides entirely, so we don't want to commit to them externally by publishing a release with them. Or we may decide to include them both internally and externally. For now, we'll be conservative.

RELNOTES=n/a
PiperOrigin-RevId: 582099306
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Nov 13, 2023
1 parent ed21dbb commit 464bedf
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 172 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -664,22 +664,6 @@ public E last() {
return descendingIterator().next();
}

/**
* @since NEXT. Note, however, that Java 21 users can call this method with any version of Guava.
*/
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
public final E getFirst() {
return first();
}

/**
* @since NEXT. Note, however, that Java 21 users can call this method with any version of Guava.
*/
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
public final E getLast() {
return last();
}

/**
* Guaranteed to throw an exception and leave the set unmodified.
*
Expand Down Expand Up @@ -714,66 +698,6 @@ public final E pollLast() {
throw new UnsupportedOperationException();
}

/**
* Guaranteed to throw an exception and leave the set unmodified.
*
* @since NEXT
* @throws UnsupportedOperationException always
* @deprecated Unsupported operation.
*/
@CanIgnoreReturnValue
@Deprecated
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
@DoNotCall("Always throws UnsupportedOperationException")
public final E removeFirst() {
throw new UnsupportedOperationException();
}

/**
* Guaranteed to throw an exception and leave the set unmodified.
*
* @since NEXT
* @throws UnsupportedOperationException always
* @deprecated Unsupported operation.
*/
@CanIgnoreReturnValue
@Deprecated
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
@DoNotCall("Always throws UnsupportedOperationException")
public final E removeLast() {
throw new UnsupportedOperationException();
}

/**
* Guaranteed to throw an exception and leave the set unmodified.
*
* @since NEXT
* @throws UnsupportedOperationException always
* @deprecated Unsupported operation.
*/
@Deprecated
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
@DoNotCall("Always throws UnsupportedOperationException")
@CheckForNull
public final void addFirst(E e) {
throw new UnsupportedOperationException();
}

/**
* Guaranteed to throw an exception and leave the set unmodified.
*
* @since NEXT
* @throws UnsupportedOperationException always
* @deprecated Unsupported operation.
*/
@Deprecated
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
@DoNotCall("Always throws UnsupportedOperationException")
@CheckForNull
public final void addLast(E e) {
throw new UnsupportedOperationException();
}

@GwtIncompatible // NavigableSet
@LazyInit
@CheckForNull
Expand All @@ -792,16 +716,6 @@ public ImmutableSortedSet<E> descendingSet() {
return result;
}

/**
* @since NEXT. Note, however, that a variant of this method with return type {@link NavigableSet}
* is available to Java 21 users with any version of Guava.
*/
@GwtIncompatible // NavigableSet
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
public final ImmutableSortedSet<E> reversed() {
return descendingSet();
}

// Most classes should implement this as new DescendingImmutableSortedSet<E>(this),
// but we push down that implementation because ProGuard can't eliminate it even when it's always
// overridden.
Expand Down
86 changes: 0 additions & 86 deletions guava/src/com/google/common/collect/ImmutableSortedSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -731,22 +731,6 @@ public E last() {
return descendingIterator().next();
}

/**
* @since NEXT. Note, however, that Java 21 users can call this method with any version of Guava.
*/
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
public final E getFirst() {
return first();
}

/**
* @since NEXT. Note, however, that Java 21 users can call this method with any version of Guava.
*/
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
public final E getLast() {
return last();
}

/**
* Guaranteed to throw an exception and leave the set unmodified.
*
Expand Down Expand Up @@ -781,66 +765,6 @@ public final E pollLast() {
throw new UnsupportedOperationException();
}

/**
* Guaranteed to throw an exception and leave the set unmodified.
*
* @since NEXT
* @throws UnsupportedOperationException always
* @deprecated Unsupported operation.
*/
@CanIgnoreReturnValue
@Deprecated
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
@DoNotCall("Always throws UnsupportedOperationException")
public final E removeFirst() {
throw new UnsupportedOperationException();
}

/**
* Guaranteed to throw an exception and leave the set unmodified.
*
* @since NEXT
* @throws UnsupportedOperationException always
* @deprecated Unsupported operation.
*/
@CanIgnoreReturnValue
@Deprecated
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
@DoNotCall("Always throws UnsupportedOperationException")
public final E removeLast() {
throw new UnsupportedOperationException();
}

/**
* Guaranteed to throw an exception and leave the set unmodified.
*
* @since NEXT
* @throws UnsupportedOperationException always
* @deprecated Unsupported operation.
*/
@Deprecated
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
@DoNotCall("Always throws UnsupportedOperationException")
@CheckForNull
public final void addFirst(E e) {
throw new UnsupportedOperationException();
}

/**
* Guaranteed to throw an exception and leave the set unmodified.
*
* @since NEXT
* @throws UnsupportedOperationException always
* @deprecated Unsupported operation.
*/
@Deprecated
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
@DoNotCall("Always throws UnsupportedOperationException")
@CheckForNull
public final void addLast(E e) {
throw new UnsupportedOperationException();
}

@GwtIncompatible // NavigableSet
@LazyInit
@CheckForNull
Expand All @@ -859,16 +783,6 @@ public ImmutableSortedSet<E> descendingSet() {
return result;
}

/**
* @since NEXT. Note, however, that a variant of this method with return type {@link NavigableSet}
* is available to Java 21 users with any version of Guava.
*/
@GwtIncompatible // NavigableSet
@SuppressWarnings("MissingOverride") // only an override under JDK 21+
public final ImmutableSortedSet<E> reversed() {
return descendingSet();
}

// Most classes should implement this as new DescendingImmutableSortedSet<E>(this),
// but we push down that implementation because ProGuard can't eliminate it even when it's always
// overridden.
Expand Down

0 comments on commit 464bedf

Please sign in to comment.