Skip to content

Commit 7b09124

Browse files
chashnikovamaembo
authored andcommitted
Better 'last resort' explanation
1 parent f9463dd commit 7b09124

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

common/src/main/java/org/jetbrains/annotations/TestOnly.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
* Apart from documentation purposes this annotation is intended to be used by static analysis tools
2424
* to validate against element contract violations.
2525
* <p>
26-
* This annotation should be used only as a last resort.
26+
* This annotation means that the annotated element exposes internal data and breaks encapsulation
27+
* of the containing class; the annotation won't prevent its use from production code, developers
28+
* even won't see warnings if their IDE doesn't support the annotation. It's better to provide
29+
* proper API which can be used in production as well as in tests.
2730
*/
2831
@Documented
2932
@Retention(RetentionPolicy.CLASS)

common/src/main/java/org/jetbrains/annotations/VisibleForTesting.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
* <li>It's illegal to annotate private member/type as VisibleForTesting.</li>
3333
* </ul>
3434
* <p>
35-
* This annotation should be used only as a last resort.
35+
* This annotation means that the annotated element exposes internal data and breaks encapsulation
36+
* of the containing class; the annotation won't prevent its use from production code, developers
37+
* even won't see warnings if their IDE doesn't support the annotation. It's better to provide
38+
* proper API which can be used in production as well as in tests.
3639
*
3740
* @since 20.0.0
3841
*/

0 commit comments

Comments
 (0)