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

Include our Collector APIs as package-private in our open-source Android codebase. #6865

Merged
1 commit merged into from Dec 8, 2023

Conversation

copybara-service[bot]
Copy link
Contributor

@copybara-service copybara-service bot commented Dec 8, 2023

Include our Collector APIs as package-private in our open-source Android codebase.

This is a test before exposing them as public. We have successfully used them inside Google, but we want to test as much as we can before adding them to our open-source project, since we don't want to have to remove them later.

Package-private APIs are of course of no use to users. However, there mere existence may be enough to cause problems for build tools or for Android apps that perform runtime reflection on the Guava classes (which incidentally we do not recommend, for this and other reasons). Our hope is that such problems are rare to nonexistent or, failing that, that they can be solved by enabling library desugaring for any affected apps.

Please do report any problems that this change causes.

The next step before exposing the APIs as public will likely be to expose an override of spliterator(). Since that API will be an override, it is more likely to be preserved by optimizers, which might remove the unused Collector APIs. (Sadly, we can't prevent that by inserting a usage of the Collector APIs in "real code" because that would require all our users to enable library desugaring.)

(Originally, I'd planned to expose spliterator() immediately, as discussed in cl/576629272. In fact, that CL did expose the method. However, we never released it. (And even if we had, I think we could remove it, since either it's an override (in which case calls to it will continue to work after it's removed) or it's not (in which case Java 8 APIs aren't available, so calls to it would never have worked.) But I think the approach of this current CL is more conservative.)

If all goes well, we'll then expose the APIs as public. We might considering using @Beta for a time, but we'd be unlikely to remove them, so again, please report any problems that this change or any future Java-8-API change causes you.

(This CL requires lots of @IgnoreJRERequirement annotations. In an ideal world, we'd run Animal Sniffer twice: one run that allows APIs that require library desugaring and one that doesn't, with our classes' using a separate @IgnoreJRERequirement-style annotation for APIs like these.)

This change is further progress toward #6567.

RELNOTES=This version of guava-android contains some package-private methods whose signature includes the Java 8 Collector API. This is a test to identify any problems before we expose those methods publicly to users. Please report any problems that you encounter.

@copybara-service copybara-service bot force-pushed the test_588869192 branch 2 times, most recently from f6aa5d4 to 0bb5b04 Compare December 8, 2023 18:37
…droid codebase.

This is a test before exposing them as `public`. We have successfully used them inside Google, but we want to test as much as we can before adding them to our open-source project, since we don't want to have to remove them later.

Package-private APIs are of course of no use to users. However, there mere existence may be enough to cause problems for build tools or for Android apps that perform runtime reflection on the Guava classes (which incidentally we do not recommend, for this and other reasons). Our hope is that such problems are rare to nonexistent or, failing that, that they can be solved by enabling [library desugaring](https://developer.android.com/studio/write/java8-support#library-desugaring) for any affected apps.

Please do report any problems that this change causes.

The next step before exposing the APIs as `public` will likely be to expose an override of `spliterator()`. Since that API will be an override, it is more likely to be preserved by optimizers, which might remove the unused `Collector` APIs. (Sadly, we can't prevent that by inserting a usage of the `Collector` APIs in "real code" because that would require all our users to enable library desugaring.)

(Originally, I'd planned to expose `spliterator()` immediately, as discussed in cl/576629272. In fact, that CL _did_ expose the method. However, we never released it. (And even if we had, I think we could remove it, since either it's an override (in which case calls to it will continue to work after it's removed) or it's not (in which case Java 8 APIs aren't available, so calls to it would never have worked.) But I think the approach of this current CL is more conservative.)

If all goes well, we'll then expose the APIs as `public`. We might considering using `@Beta` for a time, but we'd be unlikely to remove them, so again, please report any problems that this change or any future Java-8-API change causes you.

(This CL requires lots of `@IgnoreJRERequirement` annotations. In an ideal world, we'd run Animal Sniffer twice: one run that allows APIs that require library desugaring and one that doesn't, with our classes' using a separate `@IgnoreJRERequirement`-style annotation for APIs like these.)

This change is further progress toward #6567.

RELNOTES=This version of `guava-android` contains some package-private methods whose signature includes the Java 8 `Collector` API. This is a test to identify any problems before we expose those methods publicly to users. Please report any problems that you encounter.
PiperOrigin-RevId: 589183735
@copybara-service copybara-service bot closed this pull request by merging all changes into master in 73dbf7e Dec 8, 2023
@copybara-service copybara-service bot closed this Dec 8, 2023
@copybara-service copybara-service bot deleted the test_588869192 branch December 8, 2023 18:58
@jbduncan
Copy link
Contributor

jbduncan commented Dec 9, 2023

Hi @SteveBombardier, I'm confused by your last two messages because this is an open source project, so I'm struggling to understand your concerns about money etc. regarding this Pull Request or Guava in general, if I've understood your messages correctly. Can you enlighten us?

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

2 participants