Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add [SequencedCollection](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/SequencedCollection.html) methods to ImmutableSortedSet. #6796

Closed
wants to merge 1 commit into from

Conversation

copybara-service[bot]
Copy link
Contributor

Add SequencedCollection methods to ImmutableSortedSet.

There are a couple reasons that this is maybe kind of nice, and then there's my real motivation for doing it.

Reasons that this is maybe kind of nice:

  • We add @DoNotCall and @Deprecated to the mutator methods, as usual.
  • We refine the return type of reversed() to ImmutableSortedSet.

But again, those aren't my real motivation. (If they were my real motivation, you might notice, then there would be no reason for us to override getFirst() and getLast().)

My real motivation is that we are looking to give guava-android APIs that use Java 8+ types in their signatures, such as ImmutableSet.toImmutableSet. And as a result of some part of those changes, we start seeing errors in some of our Google-internal build rules. Those errors come because some the desugaring process is inserting its own versions of getFirst and friends, versions that refer to the desugar-provided copies of SortedSet and NavigableSet, which our build process then looks for but cannot find.

Since this CL is preparation for adding ImmutableSet.toImmutableSet, it constitutes further progress toward #6567

RELNOTES=collect: Added SequencedCollection methods to ImmutableSortedSet.

…/docs/api/java.base/java/util/SequencedCollection.html) methods to `ImmutableSortedSet`.

There are a couple reasons that this is maybe kind of nice, and then there's my real motivation for doing it.

Reasons that this is maybe kind of nice:

- We add `@DoNotCall` and `@Deprecated` to the mutator methods, as usual.
- We refine the return type of `reversed()` to `ImmutableSortedSet`.

But again, those aren't my real motivation. (If they _were_ my real motivation, you might notice, then there would be no reason for us to override `getFirst()` and `getLast()`.)

My _real_ motivation is that we are looking to give `guava-android` APIs that use Java 8+ types in their signatures, such as `ImmutableSet.toImmutableSet`. And as a result of some part of those changes, we start seeing errors in some of our Google-internal build rules. Those errors come because some the desugaring process is inserting its own versions of `getFirst` and friends, versions that refer to the desugar-provided copies of `SortedSet` and `NavigableSet`, which our build process then looks for but cannot find.

Since this CL is preparation for adding `ImmutableSet.toImmutableSet`, it constitutes further progress toward #6567

RELNOTES=`collect`: Added [`SequencedCollection`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/SequencedCollection.html) methods to `ImmutableSortedSet`.
PiperOrigin-RevId: 575207552
@copybara-service copybara-service bot closed this Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant