Skip to content

Commit 592202a

Browse files
adonovannetdpb
authored andcommitted
guava: disavow VisibleForTesting
Johannes and I invented this class in the early days of Blaze, and in hindsight it was clearly a mistake; it encourages self-deception. This change adds a comment discouraging its further use. RELNOTES=n/a ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=314347092
1 parent 571cf66 commit 592202a

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

android/guava/src/com/google/common/annotations/VisibleForTesting.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
* Annotates a program element that exists, or is more widely visible than otherwise necessary, only
1919
* for use in test code.
2020
*
21+
* <p><b>Do not use this interface</b> for public or protected declarations: it is a fig leaf for
22+
* bad design, and it does not prevent anyone from using the declaration---and experience has shown
23+
* that they will. If the method breaks the encapsulation of its class, then its internal
24+
* representation will be hard to change. Instead, use <a
25+
* href="http://errorprone.info/bugpattern/RestrictedApiChecker">RestrictedApiChecker</a>, which
26+
* enforces fine-grained visibility policies.
27+
*
2128
* @author Johannes Henkel
2229
*/
2330
@GwtCompatible

guava/src/com/google/common/annotations/VisibleForTesting.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
* Annotates a program element that exists, or is more widely visible than otherwise necessary, only
1919
* for use in test code.
2020
*
21+
* <p><b>Do not use this interface</b> for public or protected declarations: it is a fig leaf for
22+
* bad design, and it does not prevent anyone from using the declaration---and experience has shown
23+
* that they will. If the method breaks the encapsulation of its class, then its internal
24+
* representation will be hard to change. Instead, use <a
25+
* href="http://errorprone.info/bugpattern/RestrictedApiChecker">RestrictedApiChecker</a>, which
26+
* enforces fine-grained visibility policies.
27+
*
2128
* @author Johannes Henkel
2229
*/
2330
@GwtCompatible

0 commit comments

Comments
 (0)