From 1c6b7ed1ae147600fd28760489e10e7a8fbc2ba4 Mon Sep 17 00:00:00 2001 From: "Natalia.Ukhorskaya" Date: Thu, 18 Oct 2012 18:59:44 +0400 Subject: [PATCH] Add jet.deprecated to library --- compiler/frontend/src/jet/Library.jet | 1 + .../jetbrains/jet/lang/types/lang/KotlinBuiltIns.java | 9 +++++++++ compiler/testData/builtin-classes.txt | 3 +++ 3 files changed, 13 insertions(+) diff --git a/compiler/frontend/src/jet/Library.jet b/compiler/frontend/src/jet/Library.jet index 93643bba20e..b875c86c440 100644 --- a/compiler/frontend/src/jet/Library.jet +++ b/compiler/frontend/src/jet/Library.jet @@ -5,6 +5,7 @@ public trait Annotation public annotation class volatile : Annotation public annotation class atomic : Annotation public annotation class data : Annotation +public annotation class deprecated(value: String) : Annotation public fun synchronized(lock: Any, block : () -> R) : R diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/types/lang/KotlinBuiltIns.java b/compiler/frontend/src/org/jetbrains/jet/lang/types/lang/KotlinBuiltIns.java index 4430fd149ac..fc02e0c2cb6 100644 --- a/compiler/frontend/src/org/jetbrains/jet/lang/types/lang/KotlinBuiltIns.java +++ b/compiler/frontend/src/org/jetbrains/jet/lang/types/lang/KotlinBuiltIns.java @@ -431,6 +431,11 @@ public class KotlinBuiltIns { return getBuiltInClassByName("volatile"); } + @NotNull + public ClassDescriptor getDeprecatedAnnotation() { + return getBuiltInClassByName("deprecated"); + } + @NotNull public ClassDescriptor getString() { return getBuiltInClassByName("String"); @@ -831,6 +836,10 @@ public class KotlinBuiltIns { return containsAnnotation(classDescriptor, getDataClassAnnotation()); } + public boolean isDeprecated(@NotNull DeclarationDescriptor declarationDescriptor) { + return containsAnnotation(declarationDescriptor, getDeprecatedAnnotation()); + } + private boolean containsAnnotation(DeclarationDescriptor descriptor, ClassDescriptor annotationClass) { List annotations = descriptor.getOriginal().getAnnotations(); if (annotations != null) { diff --git a/compiler/testData/builtin-classes.txt b/compiler/testData/builtin-classes.txt index 697b3af77e3..829767264df 100644 --- a/compiler/testData/builtin-classes.txt +++ b/compiler/testData/builtin-classes.txt @@ -1454,6 +1454,9 @@ public final annotation class jet.atomic : jet.Annotation { public final annotation class jet.data : jet.Annotation { public final /*constructor*/ fun (): jet.data } +public final annotation class jet.deprecated : jet.Annotation { + public final /*constructor*/ fun (/*0*/ value: jet.String): jet.deprecated +} public final annotation class jet.volatile : jet.Annotation { public final /*constructor*/ fun (): jet.volatile }