Skip to content

Commit 17f4789

Browse files
committed
Make Nls/NonNls TYPE_USE
1 parent 89bb0eb commit 17f4789

File tree

5 files changed

+115
-5
lines changed

5 files changed

+115
-5
lines changed

common/src/main/java/org/intellij/lang/annotations/Language.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package org.intellij.lang.annotations;
1818

19-
import org.jetbrains.annotations.NonNls;
20-
2119
import java.lang.annotation.Retention;
2220
import java.lang.annotation.RetentionPolicy;
2321
import java.lang.annotation.Target;
@@ -28,8 +26,8 @@
2826
@Target({ METHOD, FIELD, PARAMETER, LOCAL_VARIABLE, ANNOTATION_TYPE })
2927

3028
public @interface Language {
31-
@NonNls String value();
29+
String value();
3230

33-
@NonNls String prefix() default "";
34-
@NonNls String suffix() default "";
31+
String prefix() default "";
32+
String suffix() default "";
3533
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright 2000-2015 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+
* http://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.Documented;
20+
import java.lang.annotation.ElementType;
21+
import java.lang.annotation.Retention;
22+
import java.lang.annotation.RetentionPolicy;
23+
import java.lang.annotation.Target;
24+
25+
/**
26+
* Specifies that an element of the program is an user-visible string which needs to be localized.
27+
* This annotation is intended to be used by localization tools for
28+
* detecting strings which should be reported as requiring localization.
29+
*
30+
* @author mike
31+
* @see NonNls
32+
*/
33+
@Documented
34+
@Retention(RetentionPolicy.CLASS)
35+
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE, ElementType.TYPE, ElementType.PACKAGE})
36+
public @interface Nls {
37+
38+
enum Capitalization {
39+
40+
NotSpecified,
41+
/**
42+
* e.g. This Is a Title
43+
*/
44+
Title,
45+
/**
46+
* e.g. This is a sentence
47+
*/
48+
Sentence
49+
}
50+
51+
Capitalization capitalization() default Capitalization.NotSpecified;
52+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright 2000-2009 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+
* http://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.Documented;
20+
import java.lang.annotation.ElementType;
21+
import java.lang.annotation.Retention;
22+
import java.lang.annotation.RetentionPolicy;
23+
import java.lang.annotation.Target;
24+
25+
/**
26+
* Specifies that an element of the program is not an user-visible string which needs to be localized,
27+
* or does not contain such strings. This annotation is intended to be used by localization tools for
28+
* detecting strings which should not be reported as requiring localization.
29+
* <ul>
30+
* <li>If a method parameter is annotated with {@code NonNls}, the strings passed
31+
* as values of this parameter are not reported as requiring localization.
32+
* Also, if the parameter of a property setter method is annotated with {@code NonNls}, values
33+
* of that property in UI Designer forms are never highlighted as hard-coded strings.</li>
34+
* <li>If a field is annotated with {@code NonNls}, all string literals found in the
35+
* initializer of the field are not reported as requiring localization.</li>
36+
* <li>If a method is called on a field, parameter or local variable annotated with {@code NonNls},
37+
* string literals passed as parameters to the method are not reported as requiring localization.
38+
* <li>If a field, parameter or local variable annotated with {@code NonNls} is passed as a
39+
* parameter to the {@code equals()} method invoked on a string literal, the literal is not
40+
* reported as requiring localization.</li>
41+
* <li>If a field, parameter or local variable annotated with {@code NonNls} is found at
42+
* the left side of an assignment expression, all string literals in the right side
43+
* of the expression are not reported as requiring localization.</li>
44+
* <li>If a method is annotated with {@code NonNls}, string literals returned from the method
45+
* are not reported as requiring localization.</li>
46+
* <li>If a class is annotated with {@code NonNls}, all string literals in
47+
* the class and all its subclasses are not reported as requiring localization.</li>
48+
* <li>If a package is annotated with {@code NonNls}, all string literals in
49+
* the package and all its subpackages are not reported as requiring localization.</li>
50+
* </ul>
51+
*
52+
* @author max
53+
* @see Nls
54+
*/
55+
@Documented
56+
@Retention(RetentionPolicy.CLASS)
57+
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE, ElementType.TYPE, ElementType.PACKAGE})
58+
public @interface NonNls {
59+
60+
}

0 commit comments

Comments
 (0)