diff --git a/common/src/main/java/org/intellij/lang/annotations/Language.java b/common/src/main/java/org/intellij/lang/annotations/Language.java index f0322d1..4721c36 100644 --- a/common/src/main/java/org/intellij/lang/annotations/Language.java +++ b/common/src/main/java/org/intellij/lang/annotations/Language.java @@ -44,7 +44,7 @@ */ @Documented @Retention(RetentionPolicy.CLASS) -@Target({ METHOD, FIELD, PARAMETER, LOCAL_VARIABLE, ANNOTATION_TYPE }) +@Target({ METHOD, FIELD, PARAMETER, LOCAL_VARIABLE, TYPE_USE, ANNOTATION_TYPE }) public @interface Language { /** * Language name like "JAVA", "HTML", "XML", "RegExp", etc. diff --git a/common/src/main/java/org/intellij/lang/annotations/MagicConstant.java b/common/src/main/java/org/intellij/lang/annotations/MagicConstant.java index 3f02eb7..1548cbd 100644 --- a/common/src/main/java/org/intellij/lang/annotations/MagicConstant.java +++ b/common/src/main/java/org/intellij/lang/annotations/MagicConstant.java @@ -80,6 +80,7 @@ @Target({ ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.ANNOTATION_TYPE, + ElementType.TYPE_USE, ElementType.METHOD }) public @interface MagicConstant { diff --git a/common/src/main/java/org/intellij/lang/annotations/Pattern.java b/common/src/main/java/org/intellij/lang/annotations/Pattern.java index 34ec818..3442127 100644 --- a/common/src/main/java/org/intellij/lang/annotations/Pattern.java +++ b/common/src/main/java/org/intellij/lang/annotations/Pattern.java @@ -45,7 +45,7 @@ */ @Documented @Retention(RetentionPolicy.CLASS) -@Target({ METHOD, FIELD, PARAMETER, LOCAL_VARIABLE, ANNOTATION_TYPE }) +@Target({ METHOD, FIELD, PARAMETER, LOCAL_VARIABLE, TYPE_USE, ANNOTATION_TYPE }) public @interface Pattern { /** * A regular expression that matches all the valid string literals that assigned to the annotated variables, diff --git a/common/src/main/java/org/intellij/lang/annotations/RegExp.java b/common/src/main/java/org/intellij/lang/annotations/RegExp.java index ecdeedd..1f55a19 100644 --- a/common/src/main/java/org/intellij/lang/annotations/RegExp.java +++ b/common/src/main/java/org/intellij/lang/annotations/RegExp.java @@ -34,7 +34,7 @@ */ @Documented @Retention(RetentionPolicy.CLASS) -@Target({METHOD, FIELD, PARAMETER, LOCAL_VARIABLE, ANNOTATION_TYPE}) +@Target({METHOD, FIELD, PARAMETER, LOCAL_VARIABLE, TYPE_USE, ANNOTATION_TYPE}) @Language("RegExp") public @interface RegExp { /** diff --git a/common/src/main/java/org/intellij/lang/annotations/Subst.java b/common/src/main/java/org/intellij/lang/annotations/Subst.java index aaa0f24..c18d231 100644 --- a/common/src/main/java/org/intellij/lang/annotations/Subst.java +++ b/common/src/main/java/org/intellij/lang/annotations/Subst.java @@ -41,7 +41,7 @@ * @see Pattern */ @Retention(RetentionPolicy.CLASS) -@Target({ElementType.METHOD, ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.PARAMETER}) +@Target({ElementType.METHOD, ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE, ElementType.PARAMETER}) public @interface Subst { String value(); } diff --git a/java5/build.gradle b/java5/build.gradle index dc57369..cb99a8e 100644 --- a/java5/build.gradle +++ b/java5/build.gradle @@ -36,7 +36,12 @@ sourceSets { task generateSrc(type: Copy) { from project(':common').sourceSets.main.java into generatedSourcesDir - filter { line -> line.replaceAll(", ElementType.TYPE_USE", "")} + // This filter removes + // 1. @Target({LOCAL_VARIABLE, TYPE_USE, ANNOTATION_TYPE}) => @Target({LOCAL_VARIABLE, ANNOTATION_TYPE}) + // 2. @Target({ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE, ElementType.PARAMETER}) => @Target({ElementType.LOCAL_VARIABLE, ElementType.PARAMETER}) + // 3. @Target({ElementType.FIELD, ElementType.TYPE_USE}) => @Target({ElementType.FIELD, }) + // 4. @Target({ElementType.TYPE_USE, ElementType.FIELD}) => @Target({ ElementType.FIELD}) + filter { line -> line.replaceAll("\\b(ElementType.)?TYPE_USE\\b(\\w*,)?", "") } } compileJava {