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

Why are methods annotated with @OverrideOnly? #420

Closed
A248 opened this issue Jul 29, 2021 · 1 comment · Fixed by #365
Closed

Why are methods annotated with @OverrideOnly? #420

A248 opened this issue Jul 29, 2021 · 1 comment · Fixed by #365

Comments

@A248
Copy link

A248 commented Jul 29, 2021

I noticed that calling ForwardingAudience#audiences generates a warning in my IDE that the method is annotated with @OverrideOnly. What is the purpose of making this method, in particular, annotated with @OverrideOnly? In my case, I wanted to make a new ForwardingAudience implementation whose audiences() is based on a manipulation of another ForwardingAudience's audiences(), while preserving the ability to run operations on specific audiences in the Iterable.

I have broader questions about the use of @OverrideOnly. It is easy to compile calls to these methods considering there is no compiler warning due to their usage. From a perspective of pure API compatibility, are these methods considered equal to any other, even when they are called?

@astei
Copy link
Contributor

astei commented Aug 3, 2021

To answer the original question directly, @kashike on Discord stated that the purpose was to discourage iterating over audiences() to invoke operations on the underlying audiences directly and instead promote the correct style of calling methods on the Audience directly. The method, by necessity, is exposed since there has to be a way to supply audiences to the forwarding functions in ForwardingAudience.

Perhaps you'd like to open a discussion changing ForwardingAudience itself, and if so, that's fine. I don't have any real problems with ForwardingAudience as it is now (speaking as a developer of a platform that uses Adventure natively).

@zml2008 zml2008 linked a pull request Sep 4, 2021 that will close this issue
@zml2008 zml2008 added this to the 4.9.0 milestone Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants