Debian Codegraph @

src/org/jetbrains/annotations/NonNls.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
17 package org.jetbrains.annotations;
18
19 import java.lang.annotation.*;
20
21 /**
22 * Specifies that an element of the program is not a user-visible string which needs to be localized,
23 * or does not contain such strings. This annotation is intended to be used by localization tools for
24 * detecting strings which should not be reported as requiring localization.
25 * <ul>
26 * <li>If a method parameter is annotated with {@code NonNls}, the strings passed
27 * as values of this parameter are not reported as requiring localization.
28 * Also, if the parameter of a property setter method is annotated with {@code NonNls}, values
29 * of that property in UI Designer forms are never highlighted as hard-coded strings.</li>
30 * <li>If a field is annotated with {@code NonNls}, all string literals found in the
31 * initializer of the field are not reported as requiring localization.</li>
32 * <li>If a method is called on a field, parameter or local variable annotated with {@code NonNls},
33 * string literals passed as parameters to the method are not reported as requiring localization.
34 * <li>If a field, parameter or local variable annotated with {@code NonNls} is passed as a
35 * parameter to the {@code equals()} method invoked on a string literal, the literal is not
36 * reported as requiring localization.</li>
37 * <li>If a field, parameter or local variable annotated with {@code NonNls} is found at
38 * the left side of an assignment expression, all string literals in the right side
39 * of the expression are not reported as requiring localization.</li>
40 * <li>If a method is annotated with {@code NonNls}, string literals returned from the method
41 * are not reported as requiring localization.</li>
42 * <li>If a class is annotated with {@code NonNls}, all string literals in
43 * the class and all its subclasses are not reported as requiring localization.</li>
44 * <li>If a package is annotated with {@code NonNls}, all string literals in
45 * the package and all its subpackages are not reported as requiring localization.</li>
46 * </ul>
47 *
48 * <p>
49 * This annotation also could be used as a meta-annotation, to define derived annotations for convenience.
50 * E.g. the following annotation could be defined to annotate the strings that represent UUIDs,
51 * thus should not be localized:
52 *
53 * <pre>
54 * &#64;NonNls
55 * &#64;interface UUID {}
56 * </pre>
57 * <p>
58 * Note that using the derived annotation as meta-annotation is not supported.
59 * Meta-annotation works only one level deep.
60 */
61 @Documented
62 @Retention(RetentionPolicy.CLASS)
63 @Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE, ElementType.TYPE, ElementType.PACKAGE})
64 public @interface NonNls {
65
66 }