Debian Codegraph @

src/org/jetbrains/annotations/VisibleForTesting.java

raw symbols SCIP
1 /*
2 * Copyright 2000-2021 JetBrains s.r.o.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.jetbrains.annotations;
17
18 import java.lang.annotation.Documented;
19 import java.lang.annotation.ElementType;
20 import java.lang.annotation.Retention;
21 import java.lang.annotation.RetentionPolicy;
22 import java.lang.annotation.Target;
23
24 /**
25 * A member or type annotated with VisibleForTesting claims that its visibility is higher than necessary,
26 * only for testing purposes. In particular:
27 * <ul>
28 * <li>If public or protected member/type is annotated with VisibleForTesting,
29 * it's assumed that package-private access is enough for production code.</li>
30 * <li>If package-private member/type is annotated with VisibleForTesting,
31 * it's assumed that private access is enough for production code.</li>
32 * <li>It's illegal to annotate private member/type as VisibleForTesting.</li>
33 * </ul>
34 * <p>
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.
39 *
40 * @since 20.0.0
41 */
42 @Documented
43 @Retention(RetentionPolicy.CLASS)
44 @Target({ElementType.METHOD, ElementType.CONSTRUCTOR, ElementType.FIELD, ElementType.TYPE})
45 public @interface VisibleForTesting { }