-
Notifications
You must be signed in to change notification settings - Fork 125
Don't document elements with @internal
#4048
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
base: main
Are you sure you want to change the base?
Conversation
Honestly I'm a bit skeptical with hiding visibleForTesting allows any test suite to access those utils, not just the test folder of the defining package. So it is public API. |
According to the documentation it only allows test suites from the same package to access it: Not sure if that is how the warnings actually work |
I have tried out the warnings. And indeed it seems you can import a |
Oops, yeah. That's now how the analyzer runs things. But also, I think I prefer the analyzer's interpretation, over the documented behavior ("of the defining package"). We could change the docs. |
I like the current behavior of I use abstract class Notifier<T> {
@protected
@visibleForTesting
T state;
} So within production code, "state" is protected, to promote good separation of concern. We could also imagine that a package defining This avoids having to make two packages to separate dev dependencies from non-dev ones, without compromising tree shaking. |
Not sure where to go from here. It seems that both of these annotations have a vague relation re. what it means for the annotatee to the exported. Sounds like we could use 4 annotations:
All of these seem to have at least some use cases. And the documentation around Filed dart-lang/sdk#60731 |
We're not limited to applying a single annotation. So given:
We could combine visibleForTesting+internal to achieve both: @internal
@visibleForTesting
int a; // only usable in the tests of the defining package
@visibleForTesting
int b; // usable by any test I'm not sure what the current behavior is, but that feels like a good solution As for the other two proposals, I'm not sure how they relate to The annotation has a really good behavior. I wouldn't change it. Maybe the Doc needs a little bit of rewording, but no code change. |
Could we make a smaller incremental change, just addressing the |
@internal
or @visibleForTesting
@internal
Makes members with the
@internal
or@visibleForTesting
documents not part of the public interface.#2418