0

Java style guide - use @VisibleForTesting for test-only constructors

Bug: None
Change-Id: Ideb862e1c3ef893286f8cdb092088d426f4e44e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4650698
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1165633}
This commit is contained in:
Andrew Grieve
2023-07-04 15:16:35 +00:00
committed by Chromium LUCI CQ
parent d6a3226b0a
commit e27a4f715b

@ -276,10 +276,11 @@ Symbols that are made public (or package-private) for the sake of tests
should be annotated with [`@VisibleForTesting`]. Android Lint will check
that calls from non-test code respect the "otherwise" visibility.
Symbols with a `ForTesting` suffix should **not** be annotated with
Symbols with a `ForTesting` suffix **should not** be annotated with
`@VisibleForTesting`. While `otherwise=VisibleForTesting.NONE` exists, it
is redundant given the "ForTesting" suffix and the associated lint check
is redundant given our trybot check.
is redundant given our trybot check. You should, however, use it for
test-only constructors.
[ensure they are removed]: /docs/speed/binary_size/android_binary_size_trybot.md#Added-Symbols-named-ForTest
[`PRESUMBIT.py`]: https://chromium.googlesource.com/chromium/src/+/main/PRESUBMIT.py