From b4399b8b8b0228c939e1429ff0c4ad524eaff0ae Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Fri, 11 Sep 2015 16:02:28 +0300 Subject: [PATCH] AnnotationTarget.CLASSIFIER and KotlinTarget.CLASSIFIER both dropped (second step) --- .../kotlin/codegen/AnnotationCodegen.java | 1 - .../kotlin/resolve/AnnotationChecker.kt | 2 +- .../kotlin/resolve/ModifiersChecker.kt | 14 +++++++------- compiler/testData/builtin-classes.txt | 6 +++--- core/builtins/src/kotlin/Annotations.kt | 6 +++--- .../src/kotlin/annotation/Annotations.kt | 1 - .../descriptors/annotations/KotlinTarget.kt | 17 ++++++++--------- .../src/kotlin/jvm/PurelyImplements.kt | 2 +- js/js.libraries/src/core/annotations.kt | 6 +++--- .../stdlib/src/kotlin/jvm/JvmFlagAnnotations.kt | 2 +- 10 files changed, 27 insertions(+), 30 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/AnnotationCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/AnnotationCodegen.java index 0841328dbda..c76fb2f1cad 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/AnnotationCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/AnnotationCodegen.java @@ -188,7 +188,6 @@ public abstract class AnnotationCodegen { new EnumMap(KotlinTarget.class); static { - annotationTargetMap.put(KotlinTarget.CLASSIFIER, ElementType.TYPE); annotationTargetMap.put(KotlinTarget.CLASS, 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 507ead78a09..099244dba16 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/AnnotationChecker.kt @@ -203,7 +203,7 @@ public class AnnotationChecker(private val additionalCheckers: Iterable>( INNER_KEYWORD to EnumSet.of(CLASS_ONLY, INNER_CLASS, LOCAL_CLASS, ENUM_CLASS, ENUM_ENTRY), - OVERRIDE_KEYWORD to EnumSet.of(CLASS, CLASSIFIER, ENUM_ENTRY), - PROTECTED_KEYWORD to EnumSet.of(CLASS, CLASSIFIER, ENUM_ENTRY), + OVERRIDE_KEYWORD to EnumSet.of(CLASS, ENUM_ENTRY), + PROTECTED_KEYWORD to EnumSet.of(CLASS, ENUM_ENTRY), COMPANION_KEYWORD to EnumSet.of(CLASS_ONLY, ENUM_CLASS, INTERFACE) ) diff --git a/compiler/testData/builtin-classes.txt b/compiler/testData/builtin-classes.txt index 7f58905ea28..54e22e119b8 100644 --- a/compiler/testData/builtin-classes.txt +++ b/compiler/testData/builtin-classes.txt @@ -283,7 +283,7 @@ public interface Comparable { public abstract fun compareTo(/*0*/ other: T): kotlin.Int } -kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASSIFIER, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER}) kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() public final class Deprecated : kotlin.Annotation { +kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER}) kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() public final class Deprecated : kotlin.Annotation { /*primary*/ public constructor Deprecated(/*0*/ value: kotlin.String, /*1*/ replaceWith: kotlin.ReplaceWith = ...) public final val replaceWith: kotlin.ReplaceWith public final fun (): kotlin.ReplaceWith @@ -1235,7 +1235,7 @@ public final class String : kotlin.Comparable, kotlin.CharSequenc } } -kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASSIFIER, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPE, AnnotationTarget.EXPRESSION, AnnotationTarget.FILE}) kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.annotation() public final class Suppress : kotlin.Annotation { +kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.LOCAL_VARIABLE, AnnotationTarget.VALUE_PARAMETER, AnnotationTarget.CONSTRUCTOR, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.TYPE, AnnotationTarget.EXPRESSION, AnnotationTarget.FILE}) kotlin.annotation.Retention(value = AnnotationRetention.SOURCE) kotlin.annotation.annotation() public final class Suppress : kotlin.Annotation { /*primary*/ public constructor Suppress(/*0*/ vararg names: kotlin.String /*kotlin.Array*/) public final val names: kotlin.Array public final fun (): kotlin.Array @@ -1256,7 +1256,7 @@ kotlin.annotation.Target(allowedTargets = {AnnotationTarget.VALUE_PARAMETER}) ko /*primary*/ public constructor crossinline() } -kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASSIFIER}) kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() public final class data : kotlin.Annotation { +kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) kotlin.annotation.MustBeDocumented() kotlin.annotation.annotation() public final class data : kotlin.Annotation { /*primary*/ public constructor data() } diff --git a/core/builtins/src/kotlin/Annotations.kt b/core/builtins/src/kotlin/Annotations.kt index 16d2db7a346..3cb3f3600fb 100644 --- a/core/builtins/src/kotlin/Annotations.kt +++ b/core/builtins/src/kotlin/Annotations.kt @@ -26,7 +26,7 @@ import kotlin.annotation.AnnotationTarget.* * See [the Kotlin language documentation](http://kotlinlang.org/docs/reference/data-classes.html) * for more information. */ -@Target(CLASSIFIER) +@Target(CLASS) @MustBeDocumented public annotation class data @@ -36,7 +36,7 @@ public annotation class data * @property replaceWith if present, specifies a code fragment which should be used as a replacement for * the deprecated API usage. */ -@Target(CLASSIFIER, FUNCTION, PROPERTY, ANNOTATION_CLASS, CONSTRUCTOR, PROPERTY_SETTER, PROPERTY_GETTER, +@Target(CLASS, FUNCTION, PROPERTY, ANNOTATION_CLASS, CONSTRUCTOR, PROPERTY_SETTER, PROPERTY_GETTER, LOCAL_VARIABLE, VALUE_PARAMETER) @MustBeDocumented public annotation class Deprecated(val value: String, val replaceWith: ReplaceWith = ReplaceWith("")) @@ -70,7 +70,7 @@ public annotation class Extension * Suppresses the given compilation warnings in the annotated element. * @property names names of the compiler diagnostics to suppress. */ -@Target(CLASSIFIER, ANNOTATION_CLASS, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER, +@Target(CLASS, ANNOTATION_CLASS, PROPERTY, FIELD, LOCAL_VARIABLE, VALUE_PARAMETER, CONSTRUCTOR, FUNCTION, PROPERTY_GETTER, PROPERTY_SETTER, TYPE, EXPRESSION, FILE) @Retention(SOURCE) public annotation class Suppress(vararg val names: String) diff --git a/core/builtins/src/kotlin/annotation/Annotations.kt b/core/builtins/src/kotlin/annotation/Annotations.kt index 6836194df73..a2f2b966604 100644 --- a/core/builtins/src/kotlin/annotation/Annotations.kt +++ b/core/builtins/src/kotlin/annotation/Annotations.kt @@ -21,7 +21,6 @@ package kotlin.annotation */ public enum class AnnotationTarget { /** Class, interface or object, annotation class is also included */ - CLASSIFIER, CLASS, /** Annotation class only */ ANNOTATION_CLASS, 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 fc57310ff74..9f62c5a2ba6 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) { - CLASSIFIER("class"), // deprecated: migrates to CLASS CLASS("class"), // includes CLASS_ONLY, OBJECT, INTERFACE, *_CLASS but not ENUM_ENTRY ANNOTATION_CLASS("annotation class"), TYPE_PARAMETER("type parameter", false), @@ -80,25 +79,25 @@ public enum class KotlinTarget(val description: String, val isDefault: Boolean = public val ALL_TARGET_SET: Set = values().toSet() public fun classActualTargets(descriptor: ClassDescriptor): List = when (descriptor.kind) { - ClassKind.ANNOTATION_CLASS -> listOf(ANNOTATION_CLASS, CLASS, CLASSIFIER) + ClassKind.ANNOTATION_CLASS -> listOf(ANNOTATION_CLASS, CLASS) ClassKind.CLASS -> if (descriptor.isInner) { - listOf(INNER_CLASS, CLASS, CLASSIFIER) + listOf(INNER_CLASS, CLASS) } else if (DescriptorUtils.isLocal(descriptor)) { - listOf(LOCAL_CLASS, CLASS, CLASSIFIER) + listOf(LOCAL_CLASS, CLASS) } else { - listOf(CLASS_ONLY, CLASS, CLASSIFIER) + listOf(CLASS_ONLY, CLASS) } - ClassKind.OBJECT -> listOf(OBJECT, CLASS, CLASSIFIER) - ClassKind.INTERFACE -> listOf(INTERFACE, CLASS, CLASSIFIER) + ClassKind.OBJECT -> listOf(OBJECT, CLASS) + ClassKind.INTERFACE -> listOf(INTERFACE, CLASS) ClassKind.ENUM_CLASS -> if (DescriptorUtils.isLocal(descriptor)) { - listOf(LOCAL_CLASS, CLASS, CLASSIFIER) + listOf(LOCAL_CLASS, CLASS) } else { - listOf(ENUM_CLASS, CLASS, CLASSIFIER) + listOf(ENUM_CLASS, CLASS) } ClassKind.ENUM_ENTRY -> listOf(ENUM_ENTRY, PROPERTY, FIELD) } diff --git a/core/runtime.jvm/src/kotlin/jvm/PurelyImplements.kt b/core/runtime.jvm/src/kotlin/jvm/PurelyImplements.kt index c11a404a98a..fa360efe319 100644 --- a/core/runtime.jvm/src/kotlin/jvm/PurelyImplements.kt +++ b/core/runtime.jvm/src/kotlin/jvm/PurelyImplements.kt @@ -34,7 +34,7 @@ package kotlin.jvm * MyList().add(null) // Error * MyList().add(null) // Ok */ -@Target(AnnotationTarget.CLASSIFIER) +@Target(AnnotationTarget.CLASS) @Retention(AnnotationRetention.RUNTIME) @MustBeDocumented public annotation class PurelyImplements(public val value: String) diff --git a/js/js.libraries/src/core/annotations.kt b/js/js.libraries/src/core/annotations.kt index e3fcaa9921c..b5523edaee9 100644 --- a/js/js.libraries/src/core/annotations.kt +++ b/js/js.libraries/src/core/annotations.kt @@ -19,7 +19,7 @@ package kotlin.js import kotlin.annotation.AnnotationTarget.* native -@Target(CLASSIFIER, FUNCTION, PROPERTY, CONSTRUCTOR, VALUE_PARAMETER) +@Target(CLASS, FUNCTION, PROPERTY, CONSTRUCTOR, VALUE_PARAMETER) public annotation class native(public val name: String = "") native @@ -35,7 +35,7 @@ native public annotation class nativeInvoke native -@Target(CLASSIFIER, FUNCTION, PROPERTY) +@Target(CLASS, FUNCTION, PROPERTY) public annotation class library(public val name: String = "") native @@ -44,6 +44,6 @@ public annotation class enumerable() // TODO make it "internal" or "fake" native -@Target(CLASSIFIER) +@Target(CLASS) deprecated("Do not use this annotation: it is for internal use only") public annotation class marker \ No newline at end of file diff --git a/libraries/stdlib/src/kotlin/jvm/JvmFlagAnnotations.kt b/libraries/stdlib/src/kotlin/jvm/JvmFlagAnnotations.kt index 093d7272fac..30fa040ba32 100644 --- a/libraries/stdlib/src/kotlin/jvm/JvmFlagAnnotations.kt +++ b/libraries/stdlib/src/kotlin/jvm/JvmFlagAnnotations.kt @@ -41,7 +41,7 @@ public annotation class Transient * of floating point operations performed inside the method needs to be restricted in order to * achieve better portability. */ -@Target(FUNCTION, CONSTRUCTOR, PROPERTY_GETTER, PROPERTY_SETTER, CLASSIFIER) +@Target(FUNCTION, CONSTRUCTOR, PROPERTY_GETTER, PROPERTY_SETTER, CLASS) @Retention(AnnotationRetention.SOURCE) @MustBeDocumented public annotation class Strictfp