From 699f1e0a70109f1652908612c4b6d047eb0e7213 Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Wed, 2 Sep 2015 18:09:43 +0300 Subject: [PATCH] AnnotationTarget.PACKAGE was dropped --- .../org/jetbrains/kotlin/codegen/AnnotationCodegen.java | 1 - .../src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt | 2 -- .../src/org/jetbrains/kotlin/resolve/ModifiersChecker.kt | 2 +- .../compileJavaAgainstKotlin/targets/package-info.java | 5 ----- .../targets/package-info.javaerr.txt | 2 -- .../compileJavaAgainstKotlin/targets/package-info.kt | 4 ---- .../compileJavaAgainstKotlin/targets/package-info.txt | 8 -------- .../diagnostics/tests/modifiers/IllegalModifiers.kt | 2 +- .../compiledJava/annotations/AnnotationTargets.txt | 2 +- .../compiler/CompileJavaAgainstKotlinTestGenerated.java | 6 ------ core/builtins/src/kotlin/annotation/Annotations.kt | 2 -- .../kotlin/load/java/components/JavaAnnotationMapper.kt | 2 +- .../kotlin/descriptors/annotations/KotlinTarget.kt | 1 - 13 files changed, 4 insertions(+), 35 deletions(-) delete mode 100644 compiler/testData/compileJavaAgainstKotlin/targets/package-info.java delete mode 100644 compiler/testData/compileJavaAgainstKotlin/targets/package-info.javaerr.txt delete mode 100644 compiler/testData/compileJavaAgainstKotlin/targets/package-info.kt delete mode 100644 compiler/testData/compileJavaAgainstKotlin/targets/package-info.txt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AnnotationCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/AnnotationCodegen.java index ca29fbf1a74..f4d372e06c5 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AnnotationCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AnnotationCodegen.java @@ -187,7 +187,6 @@ public abstract class AnnotationCodegen { new EnumMap(KotlinTarget.class); static { - annotationTargetMap.put(KotlinTarget.PACKAGE, ElementType.PACKAGE); annotationTargetMap.put(KotlinTarget.CLASSIFIER, ElementType.TYPE); annotationTargetMap.put(KotlinTarget.ANNOTATION_CLASS, ElementType.ANNOTATION_TYPE); annotationTargetMap.put(KotlinTarget.CONSTRUCTOR, ElementType.CONSTRUCTOR); diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt index c420be608ef..ff0c471150d 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt @@ -165,7 +165,6 @@ public class AnnotationChecker(private val additionalCheckers: Iterable if (annotated.isGetter) TargetLists.T_PROPERTY_GETTER else TargetLists.T_PROPERTY_SETTER - is JetPackageDirective -> TargetLists.T_PACKAGE is JetTypeReference -> TargetLists.T_TYPE_REFERENCE is JetFile -> TargetLists.T_FILE is JetTypeParameter -> TargetLists.T_TYPE_PARAMETER @@ -205,7 +204,6 @@ public class AnnotationChecker(private val additionalCheckers: Iterable = when (parentDescriptor) { is ClassDescriptor -> KotlinTarget.classActualTargets(parentDescriptor) is FunctionDescriptor -> listOf(FUNCTION) - else -> listOf(PACKAGE) + else -> listOf(FILE) } val possibleParents = possibleParentTargetMap[modifier] ?: return true if (possibleParents == KotlinTarget.ALL_TARGET_SET) return true diff --git a/compiler/testData/compileJavaAgainstKotlin/targets/package-info.java b/compiler/testData/compileJavaAgainstKotlin/targets/package-info.java deleted file mode 100644 index 660755836c1..00000000000 --- a/compiler/testData/compileJavaAgainstKotlin/targets/package-info.java +++ /dev/null @@ -1,5 +0,0 @@ -@pck package test; - -@pck class My { - -} \ No newline at end of file diff --git a/compiler/testData/compileJavaAgainstKotlin/targets/package-info.javaerr.txt b/compiler/testData/compileJavaAgainstKotlin/targets/package-info.javaerr.txt deleted file mode 100644 index c4f5202f765..00000000000 --- a/compiler/testData/compileJavaAgainstKotlin/targets/package-info.javaerr.txt +++ /dev/null @@ -1,2 +0,0 @@ -package-info.java:3:1:compiler.err.annotation.type.not.applicable - diff --git a/compiler/testData/compileJavaAgainstKotlin/targets/package-info.kt b/compiler/testData/compileJavaAgainstKotlin/targets/package-info.kt deleted file mode 100644 index 4cddc103b42..00000000000 --- a/compiler/testData/compileJavaAgainstKotlin/targets/package-info.kt +++ /dev/null @@ -1,4 +0,0 @@ -package test - -target(AnnotationTarget.PACKAGE) -annotation class pck \ No newline at end of file diff --git a/compiler/testData/compileJavaAgainstKotlin/targets/package-info.txt b/compiler/testData/compileJavaAgainstKotlin/targets/package-info.txt deleted file mode 100644 index facfd4f2029..00000000000 --- a/compiler/testData/compileJavaAgainstKotlin/targets/package-info.txt +++ /dev/null @@ -1,8 +0,0 @@ -package test - -test.pck() public/*package*/ interface `package-info` { -} - -kotlin.annotation.target(allowedTargets = {AnnotationTarget.PACKAGE}) kotlin.annotation.annotation() internal final class pck : kotlin.Annotation { - public constructor pck() -} diff --git a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt index f7309d7bb15..398587e6f5f 100644 --- a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt +++ b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt @@ -1,4 +1,4 @@ -myAnnotation public package illegal_modifiers +myAnnotation public package illegal_modifiers abstract class A() { abstract final fun f() diff --git a/compiler/testData/loadJava/compiledJava/annotations/AnnotationTargets.txt b/compiler/testData/loadJava/compiledJava/annotations/AnnotationTargets.txt index c28f3147389..2e414d17f5e 100644 --- a/compiler/testData/loadJava/compiledJava/annotations/AnnotationTargets.txt +++ b/compiler/testData/loadJava/compiledJava/annotations/AnnotationTargets.txt @@ -31,7 +31,7 @@ public open class AnnotationTargets { public constructor multiple() } - kotlin.annotation.target(allowedTargets = {AnnotationTarget.PACKAGE}) public final class packag : kotlin.Annotation { + kotlin.annotation.target(allowedTargets = {}) public final class packag : kotlin.Annotation { public constructor packag() } diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java index c460efef005..f687d85144a 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileJavaAgainstKotlinTestGenerated.java @@ -622,12 +622,6 @@ public class CompileJavaAgainstKotlinTestGenerated extends AbstractCompileJavaAg doTest(fileName); } - @TestMetadata("package-info.kt") - public void testPackage_info() throws Exception { - String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/package-info.kt"); - doTest(fileName); - } - @TestMetadata("parameter.kt") public void testParameter() throws Exception { String fileName = JetTestUtils.navigationMetadata("compiler/testData/compileJavaAgainstKotlin/targets/parameter.kt"); diff --git a/core/builtins/src/kotlin/annotation/Annotations.kt b/core/builtins/src/kotlin/annotation/Annotations.kt index 80d822184fd..ce36db4a700 100644 --- a/core/builtins/src/kotlin/annotation/Annotations.kt +++ b/core/builtins/src/kotlin/annotation/Annotations.kt @@ -20,8 +20,6 @@ package kotlin.annotation * Contains the list of code elements which are the possible annotation targets */ public enum class AnnotationTarget { - /** Package directive */ - PACKAGE, /** Class, interface or object, annotation class is also included */ CLASSIFIER, /** Annotation class only */ diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/components/JavaAnnotationMapper.kt b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/components/JavaAnnotationMapper.kt index 2590650b3a4..e62003a4caf 100644 --- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/components/JavaAnnotationMapper.kt +++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/components/JavaAnnotationMapper.kt @@ -175,7 +175,7 @@ class JavaTargetAnnotationDescriptor( } public object JavaAnnotationTargetMapper { - private val targetNameLists = mapOf("PACKAGE" to EnumSet.of(KotlinTarget.PACKAGE), + private val targetNameLists = mapOf("PACKAGE" to EnumSet.noneOf(KotlinTarget::class.java), "TYPE" to EnumSet.of(KotlinTarget.CLASSIFIER), "ANNOTATION_TYPE" to EnumSet.of(KotlinTarget.ANNOTATION_CLASS), "TYPE_PARAMETER" to EnumSet.of(KotlinTarget.TYPE_PARAMETER), diff --git a/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/KotlinTarget.kt b/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/KotlinTarget.kt index dc7e154c3f9..cfaeb87f3aa 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/KotlinTarget.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/KotlinTarget.kt @@ -24,7 +24,6 @@ import java.util.* // NOTE: this enum must have the same entries with kotlin.annotation.AnnotationTarget, // and may also have some additional entries public enum class KotlinTarget(val description: String, val isDefault: Boolean = true) { - PACKAGE("package"), CLASSIFIER("classifier"), // includes CLASS, OBJECT, INTERFACE, *_CLASS but not ENUM_ENTRY ANNOTATION_CLASS("annotation class"), TYPE_PARAMETER("type parameter", false),