Include our Collector
APIs as package-private in our open-source Android codebase.
#6865
+1,072
−20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 ofspliterator()
. Since that API will be an override, it is more likely to be preserved by optimizers, which might remove the unusedCollector
APIs. (Sadly, we can't prevent that by inserting a usage of theCollector
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 8Collector
API. This is a test to identify any problems before we expose those methods publicly to users. Please report any problems that you encounter.