Refactoring: AnnotationTarget / AnnotationRetention renamed to KotlinTarget / KotlinRetention

(for not clashing with the same built-in classes)
This commit is contained in:
Mikhail Glukhikh
2015-07-22 18:56:36 +03:00
parent 414c44ade5
commit f551d64ea2
7 changed files with 75 additions and 75 deletions
@@ -168,26 +168,26 @@ public abstract class AnnotationCodegen {
generateAnnotationIfNotPresent(annotationDescriptorsAlreadyPresent, annotationClass); generateAnnotationIfNotPresent(annotationDescriptorsAlreadyPresent, annotationClass);
} }
private static final Map<AnnotationTarget, ElementType> annotationTargetMap = private static final Map<KotlinTarget, ElementType> annotationTargetMap =
new EnumMap<AnnotationTarget, ElementType>(AnnotationTarget.class); new EnumMap<KotlinTarget, ElementType>(KotlinTarget.class);
static { static {
annotationTargetMap.put(AnnotationTarget.PACKAGE, ElementType.PACKAGE); annotationTargetMap.put(KotlinTarget.PACKAGE, ElementType.PACKAGE);
annotationTargetMap.put(AnnotationTarget.CLASSIFIER, ElementType.TYPE); annotationTargetMap.put(KotlinTarget.CLASSIFIER, ElementType.TYPE);
annotationTargetMap.put(AnnotationTarget.ANNOTATION_CLASS, ElementType.ANNOTATION_TYPE); annotationTargetMap.put(KotlinTarget.ANNOTATION_CLASS, ElementType.ANNOTATION_TYPE);
annotationTargetMap.put(AnnotationTarget.CONSTRUCTOR, ElementType.CONSTRUCTOR); annotationTargetMap.put(KotlinTarget.CONSTRUCTOR, ElementType.CONSTRUCTOR);
annotationTargetMap.put(AnnotationTarget.LOCAL_VARIABLE, ElementType.LOCAL_VARIABLE); annotationTargetMap.put(KotlinTarget.LOCAL_VARIABLE, ElementType.LOCAL_VARIABLE);
annotationTargetMap.put(AnnotationTarget.FUNCTION, ElementType.METHOD); annotationTargetMap.put(KotlinTarget.FUNCTION, ElementType.METHOD);
annotationTargetMap.put(AnnotationTarget.PROPERTY_GETTER, ElementType.METHOD); annotationTargetMap.put(KotlinTarget.PROPERTY_GETTER, ElementType.METHOD);
annotationTargetMap.put(AnnotationTarget.PROPERTY_SETTER, ElementType.METHOD); annotationTargetMap.put(KotlinTarget.PROPERTY_SETTER, ElementType.METHOD);
annotationTargetMap.put(AnnotationTarget.FIELD, ElementType.FIELD); annotationTargetMap.put(KotlinTarget.FIELD, ElementType.FIELD);
annotationTargetMap.put(AnnotationTarget.VALUE_PARAMETER, ElementType.PARAMETER); annotationTargetMap.put(KotlinTarget.VALUE_PARAMETER, ElementType.PARAMETER);
} }
private void generateTargetAnnotation(@NotNull ClassDescriptor classDescriptor, @NotNull Set<String> annotationDescriptorsAlreadyPresent) { private void generateTargetAnnotation(@NotNull ClassDescriptor classDescriptor, @NotNull Set<String> annotationDescriptorsAlreadyPresent) {
String descriptor = Type.getType(Target.class).getDescriptor(); String descriptor = Type.getType(Target.class).getDescriptor();
if (!annotationDescriptorsAlreadyPresent.add(descriptor)) return; if (!annotationDescriptorsAlreadyPresent.add(descriptor)) return;
Set<AnnotationTarget> targets = AnnotationTargetChecker.INSTANCE$.possibleTargetSet(classDescriptor); Set<KotlinTarget> targets = AnnotationTargetChecker.INSTANCE$.possibleTargetSet(classDescriptor);
Set<ElementType> javaTargets; Set<ElementType> javaTargets;
if (targets == null) { if (targets == null) {
javaTargets = getJavaTargetList(classDescriptor); javaTargets = getJavaTargetList(classDescriptor);
@@ -195,7 +195,7 @@ public abstract class AnnotationCodegen {
} }
else { else {
javaTargets = EnumSet.noneOf(ElementType.class); javaTargets = EnumSet.noneOf(ElementType.class);
for (AnnotationTarget target : targets) { for (KotlinTarget target : targets) {
if (annotationTargetMap.get(target) == null) continue; if (annotationTargetMap.get(target) == null) continue;
javaTargets.add(annotationTargetMap.get(target)); javaTargets.add(annotationTargetMap.get(target));
} }
@@ -368,13 +368,13 @@ public abstract class AnnotationCodegen {
value.accept(argumentVisitor, null); value.accept(argumentVisitor, null);
} }
private static final Map<AnnotationRetention, RetentionPolicy> annotationRetentionMap = private static final Map<KotlinRetention, RetentionPolicy> annotationRetentionMap =
new EnumMap<AnnotationRetention, RetentionPolicy>(AnnotationRetention.class); new EnumMap<KotlinRetention, RetentionPolicy>(KotlinRetention.class);
static { static {
annotationRetentionMap.put(AnnotationRetention.SOURCE, RetentionPolicy.SOURCE); annotationRetentionMap.put(KotlinRetention.SOURCE, RetentionPolicy.SOURCE);
annotationRetentionMap.put(AnnotationRetention.BINARY, RetentionPolicy.CLASS); annotationRetentionMap.put(KotlinRetention.BINARY, RetentionPolicy.CLASS);
annotationRetentionMap.put(AnnotationRetention.RUNTIME, RetentionPolicy.RUNTIME); annotationRetentionMap.put(KotlinRetention.RUNTIME, RetentionPolicy.RUNTIME);
} }
@Nullable @Nullable
@@ -415,7 +415,7 @@ public abstract class AnnotationCodegen {
JetType classObjectType = getClassObjectType(enumEntry); JetType classObjectType = getClassObjectType(enumEntry);
if (classObjectType != null) { if (classObjectType != null) {
if ("kotlin/annotation/AnnotationRetention".equals(typeMapper.mapType(classObjectType).getInternalName())) { if ("kotlin/annotation/AnnotationRetention".equals(typeMapper.mapType(classObjectType).getInternalName())) {
AnnotationRetention retention = AnnotationRetention.valueOf(enumEntry.getName().asString()); KotlinRetention retention = KotlinRetention.valueOf(enumEntry.getName().asString());
return annotationRetentionMap.get(retention); return annotationRetentionMap.get(retention);
} }
} }
@@ -29,7 +29,7 @@ import org.jetbrains.kotlin.types.JetType
import org.jetbrains.kotlin.types.TypeUtils import org.jetbrains.kotlin.types.TypeUtils
import java.lang.annotation.ElementType import java.lang.annotation.ElementType
import java.util.* import java.util.*
import org.jetbrains.kotlin.descriptors.annotations.AnnotationTarget import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget
import kotlin.annotation import kotlin.annotation
public object AnnotationTargetChecker { public object AnnotationTargetChecker {
@@ -62,7 +62,7 @@ public object AnnotationTargetChecker {
public fun checkExpression(expression: JetExpression, trace: BindingTrace) { public fun checkExpression(expression: JetExpression, trace: BindingTrace) {
for (entry in expression.getAnnotationEntries()) { for (entry in expression.getAnnotationEntries()) {
checkAnnotationEntry(entry, listOf(AnnotationTarget.EXPRESSION), trace) checkAnnotationEntry(entry, listOf(KotlinTarget.EXPRESSION), trace)
} }
if (expression is JetFunctionLiteralExpression) { if (expression is JetFunctionLiteralExpression) {
for (parameter in expression.getValueParameters()) { for (parameter in expression.getValueParameters()) {
@@ -71,55 +71,55 @@ public object AnnotationTargetChecker {
} }
} }
public fun possibleTargetSet(classDescriptor: ClassDescriptor): Set<AnnotationTarget>? { public fun possibleTargetSet(classDescriptor: ClassDescriptor): Set<KotlinTarget>? {
val targetEntryDescriptor = classDescriptor.getAnnotations().findAnnotation(KotlinBuiltIns.FQ_NAMES.target) val targetEntryDescriptor = classDescriptor.getAnnotations().findAnnotation(KotlinBuiltIns.FQ_NAMES.target)
?: return null ?: return null
val valueArguments = targetEntryDescriptor.getAllValueArguments() val valueArguments = targetEntryDescriptor.getAllValueArguments()
val valueArgument = valueArguments.entrySet().firstOrNull()?.getValue() as? ArrayValue ?: return null val valueArgument = valueArguments.entrySet().firstOrNull()?.getValue() as? ArrayValue ?: return null
return valueArgument.value.filterIsInstance<EnumValue>().map { return valueArgument.value.filterIsInstance<EnumValue>().map {
AnnotationTarget.valueOrNull(it.value.getName().asString()) KotlinTarget.valueOrNull(it.value.getName().asString())
}.filterNotNull().toSet() }.filterNotNull().toSet()
} }
private fun possibleTargetSet(entry: JetAnnotationEntry, trace: BindingTrace): Set<AnnotationTarget> { private fun possibleTargetSet(entry: JetAnnotationEntry, trace: BindingTrace): Set<KotlinTarget> {
val descriptor = trace.get(BindingContext.ANNOTATION, entry) ?: return AnnotationTarget.DEFAULT_TARGET_SET val descriptor = trace.get(BindingContext.ANNOTATION, entry) ?: return KotlinTarget.DEFAULT_TARGET_SET
// For descriptor with error type, all targets are considered as possible // For descriptor with error type, all targets are considered as possible
if (descriptor.getType().isError()) return AnnotationTarget.ALL_TARGET_SET if (descriptor.getType().isError()) return KotlinTarget.ALL_TARGET_SET
val classDescriptor = TypeUtils.getClassDescriptor(descriptor.getType()) ?: return AnnotationTarget.DEFAULT_TARGET_SET val classDescriptor = TypeUtils.getClassDescriptor(descriptor.getType()) ?: return KotlinTarget.DEFAULT_TARGET_SET
return possibleTargetSet(classDescriptor) ?: AnnotationTarget.DEFAULT_TARGET_SET return possibleTargetSet(classDescriptor) ?: KotlinTarget.DEFAULT_TARGET_SET
} }
private fun checkAnnotationEntry(entry: JetAnnotationEntry, actualTargets: List<AnnotationTarget>, trace: BindingTrace) { private fun checkAnnotationEntry(entry: JetAnnotationEntry, actualTargets: List<KotlinTarget>, trace: BindingTrace) {
val possibleTargets = possibleTargetSet(entry, trace) val possibleTargets = possibleTargetSet(entry, trace)
if (actualTargets.any { it in possibleTargets }) return if (actualTargets.any { it in possibleTargets }) return
trace.report(Errors.WRONG_ANNOTATION_TARGET.on(entry, actualTargets.firstOrNull()?.description ?: "unidentified target")) trace.report(Errors.WRONG_ANNOTATION_TARGET.on(entry, actualTargets.firstOrNull()?.description ?: "unidentified target"))
} }
private fun getActualTargetList(annotated: JetAnnotated, descriptor: ClassDescriptor?): List<AnnotationTarget> { private fun getActualTargetList(annotated: JetAnnotated, descriptor: ClassDescriptor?): List<KotlinTarget> {
if (annotated is JetClassOrObject) { if (annotated is JetClassOrObject) {
if (annotated is JetEnumEntry) return listOf(AnnotationTarget.PROPERTY, AnnotationTarget.FIELD) if (annotated is JetEnumEntry) return listOf(KotlinTarget.PROPERTY, KotlinTarget.FIELD)
return if (descriptor?.getKind() == ClassKind.ANNOTATION_CLASS) { return if (descriptor?.getKind() == ClassKind.ANNOTATION_CLASS) {
listOf(AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.CLASSIFIER) listOf(KotlinTarget.ANNOTATION_CLASS, KotlinTarget.CLASSIFIER)
} }
else { else {
listOf(AnnotationTarget.CLASSIFIER) listOf(KotlinTarget.CLASSIFIER)
} }
} }
if (annotated is JetProperty) { if (annotated is JetProperty) {
return if (annotated.isLocal()) listOf(AnnotationTarget.LOCAL_VARIABLE) else listOf(AnnotationTarget.PROPERTY, AnnotationTarget.FIELD) return if (annotated.isLocal()) listOf(KotlinTarget.LOCAL_VARIABLE) else listOf(KotlinTarget.PROPERTY, KotlinTarget.FIELD)
} }
if (annotated is JetParameter) { if (annotated is JetParameter) {
return if (annotated.hasValOrVar()) listOf(AnnotationTarget.PROPERTY, AnnotationTarget.FIELD) else listOf(AnnotationTarget.VALUE_PARAMETER) return if (annotated.hasValOrVar()) listOf(KotlinTarget.PROPERTY, KotlinTarget.FIELD) else listOf(KotlinTarget.VALUE_PARAMETER)
} }
if (annotated is JetConstructor<*>) return listOf(AnnotationTarget.CONSTRUCTOR) if (annotated is JetConstructor<*>) return listOf(KotlinTarget.CONSTRUCTOR)
if (annotated is JetFunction) return listOf(AnnotationTarget.FUNCTION) if (annotated is JetFunction) return listOf(KotlinTarget.FUNCTION)
if (annotated is JetPropertyAccessor) { if (annotated is JetPropertyAccessor) {
return if (annotated.isGetter()) listOf(AnnotationTarget.PROPERTY_GETTER) else listOf(AnnotationTarget.PROPERTY_SETTER) return if (annotated.isGetter()) listOf(KotlinTarget.PROPERTY_GETTER) else listOf(KotlinTarget.PROPERTY_SETTER)
} }
if (annotated is JetPackageDirective) return listOf(AnnotationTarget.PACKAGE) if (annotated is JetPackageDirective) return listOf(KotlinTarget.PACKAGE)
if (annotated is JetTypeReference) return listOf(AnnotationTarget.TYPE) if (annotated is JetTypeReference) return listOf(KotlinTarget.TYPE)
if (annotated is JetFile) return listOf(AnnotationTarget.FILE) if (annotated is JetFile) return listOf(KotlinTarget.FILE)
if (annotated is JetTypeParameter) return listOf(AnnotationTarget.TYPE_PARAMETER) if (annotated is JetTypeParameter) return listOf(KotlinTarget.TYPE_PARAMETER)
return listOf() return listOf()
} }
} }
@@ -34,10 +34,10 @@ import org.jetbrains.kotlin.resolve.constants.ConstantValue
import org.jetbrains.kotlin.resolve.constants.EnumValue import org.jetbrains.kotlin.resolve.constants.EnumValue
import org.jetbrains.kotlin.types.ErrorUtils import org.jetbrains.kotlin.types.ErrorUtils
import org.jetbrains.kotlin.types.JetType import org.jetbrains.kotlin.types.JetType
import org.jetbrains.kotlin.descriptors.annotations.AnnotationTarget import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget
import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.descriptors.annotations.AnnotationRetention import org.jetbrains.kotlin.descriptors.annotations.KotlinRetention
import org.jetbrains.kotlin.storage.StorageManager import org.jetbrains.kotlin.storage.StorageManager
import java.lang.annotation.Retention import java.lang.annotation.Retention
import java.lang.annotation.Target import java.lang.annotation.Target
@@ -113,21 +113,21 @@ class JavaTargetAnnotationDescriptor(
} }
public object JavaAnnotationTargetMapper { public object JavaAnnotationTargetMapper {
private val targetNameLists = mapOf("PACKAGE" to EnumSet.of(AnnotationTarget.PACKAGE), private val targetNameLists = mapOf("PACKAGE" to EnumSet.of(KotlinTarget.PACKAGE),
"TYPE" to EnumSet.of(AnnotationTarget.CLASSIFIER), "TYPE" to EnumSet.of(KotlinTarget.CLASSIFIER),
"ANNOTATION_TYPE" to EnumSet.of(AnnotationTarget.ANNOTATION_CLASS), "ANNOTATION_TYPE" to EnumSet.of(KotlinTarget.ANNOTATION_CLASS),
"TYPE_PARAMETER" to EnumSet.of(AnnotationTarget.TYPE_PARAMETER), "TYPE_PARAMETER" to EnumSet.of(KotlinTarget.TYPE_PARAMETER),
"FIELD" to EnumSet.of(AnnotationTarget.FIELD), "FIELD" to EnumSet.of(KotlinTarget.FIELD),
"LOCAL_VARIABLE" to EnumSet.of(AnnotationTarget.LOCAL_VARIABLE), "LOCAL_VARIABLE" to EnumSet.of(KotlinTarget.LOCAL_VARIABLE),
"PARAMETER" to EnumSet.of(AnnotationTarget.VALUE_PARAMETER), "PARAMETER" to EnumSet.of(KotlinTarget.VALUE_PARAMETER),
"CONSTRUCTOR" to EnumSet.of(AnnotationTarget.CONSTRUCTOR), "CONSTRUCTOR" to EnumSet.of(KotlinTarget.CONSTRUCTOR),
"METHOD" to EnumSet.of(AnnotationTarget.FUNCTION, "METHOD" to EnumSet.of(KotlinTarget.FUNCTION,
AnnotationTarget.PROPERTY_GETTER, KotlinTarget.PROPERTY_GETTER,
AnnotationTarget.PROPERTY_SETTER), KotlinTarget.PROPERTY_SETTER),
"TYPE_USE" to EnumSet.of(AnnotationTarget.TYPE) "TYPE_USE" to EnumSet.of(KotlinTarget.TYPE)
) )
public fun mapJavaTargetArgumentByName(argumentName: String?): Set<AnnotationTarget> = targetNameLists[argumentName] ?: emptySet() public fun mapJavaTargetArgumentByName(argumentName: String?): Set<KotlinTarget> = targetNameLists[argumentName] ?: emptySet()
public fun mapJavaTargetArguments(arguments: List<JavaAnnotationArgument>, builtIns: KotlinBuiltIns): ConstantValue<*>? { public fun mapJavaTargetArguments(arguments: List<JavaAnnotationArgument>, builtIns: KotlinBuiltIns): ConstantValue<*>? {
// Map arguments: java.lang.annotation.Target -> kotlin.annotation.target // Map arguments: java.lang.annotation.Target -> kotlin.annotation.target
@@ -141,9 +141,9 @@ public object JavaAnnotationTargetMapper {
return ArrayValue(kotlinTargets, parameterDescriptor?.type ?: ErrorUtils.createErrorType("Error: AnnotationTarget[]"), builtIns) return ArrayValue(kotlinTargets, parameterDescriptor?.type ?: ErrorUtils.createErrorType("Error: AnnotationTarget[]"), builtIns)
} }
private val retentionNameList = mapOf("RUNTIME" to AnnotationRetention.RUNTIME, private val retentionNameList = mapOf("RUNTIME" to KotlinRetention.RUNTIME,
"CLASS" to AnnotationRetention.BINARY, "CLASS" to KotlinRetention.BINARY,
"SOURCE" to AnnotationRetention.SOURCE "SOURCE" to KotlinRetention.SOURCE
) )
public fun mapJavaRetentionArgument(element: JavaAnnotationArgument, builtIns: KotlinBuiltIns): ConstantValue<*>? { public fun mapJavaRetentionArgument(element: JavaAnnotationArgument, builtIns: KotlinBuiltIns): ConstantValue<*>? {
@@ -398,7 +398,7 @@ public class KotlinBuiltIns {
} }
@Nullable @Nullable
public ClassDescriptor getAnnotationTargetEnumEntry(@NotNull AnnotationTarget target) { public ClassDescriptor getAnnotationTargetEnumEntry(@NotNull KotlinTarget target) {
ClassifierDescriptor result = getAnnotationTargetEnum().getUnsubstitutedInnerClassesScope().getClassifier( ClassifierDescriptor result = getAnnotationTargetEnum().getUnsubstitutedInnerClassesScope().getClassifier(
Name.identifier(target.name()), UsageLocation.NO_LOCATION Name.identifier(target.name()), UsageLocation.NO_LOCATION
); );
@@ -411,7 +411,7 @@ public class KotlinBuiltIns {
} }
@Nullable @Nullable
public ClassDescriptor getAnnotationRetentionEnumEntry(@NotNull AnnotationRetention retention) { public ClassDescriptor getAnnotationRetentionEnumEntry(@NotNull KotlinRetention retention) {
ClassifierDescriptor result = getAnnotationRetentionEnum().getUnsubstitutedInnerClassesScope().getClassifier( ClassifierDescriptor result = getAnnotationRetentionEnum().getUnsubstitutedInnerClassesScope().getClassifier(
Name.identifier(retention.name()), UsageLocation.NO_LOCATION Name.identifier(retention.name()), UsageLocation.NO_LOCATION
); );
@@ -16,7 +16,7 @@
package org.jetbrains.kotlin.descriptors.annotations package org.jetbrains.kotlin.descriptors.annotations
public enum class AnnotationRetention { public enum class KotlinRetention {
RUNTIME, RUNTIME,
BINARY, BINARY,
SOURCE SOURCE
@@ -20,7 +20,7 @@ import java.util.*
import kotlin.annotation import kotlin.annotation
// NOTE: this enum must have the same entries with kotlin.annotation.AnnotationTarget // NOTE: this enum must have the same entries with kotlin.annotation.AnnotationTarget
public enum class AnnotationTarget(val description: String, val isDefault: Boolean = true) { public enum class KotlinTarget(val description: String, val isDefault: Boolean = true) {
PACKAGE("package"), PACKAGE("package"),
CLASSIFIER("classifier"), CLASSIFIER("classifier"),
ANNOTATION_CLASS("annotation class"), ANNOTATION_CLASS("annotation class"),
@@ -39,19 +39,19 @@ public enum class AnnotationTarget(val description: String, val isDefault: Boole
companion object { companion object {
private val map = HashMap<String, AnnotationTarget>() private val map = HashMap<String, KotlinTarget>()
init { init {
for (target in AnnotationTarget.values()) { for (target in KotlinTarget.values()) {
map[target.name()] = target map[target.name()] = target
} }
} }
public fun valueOrNull(name: String): AnnotationTarget? = map[name] public fun valueOrNull(name: String): KotlinTarget? = map[name]
public val DEFAULT_TARGET_SET: Set<AnnotationTarget> = values().filter { it.isDefault }.toSet() public val DEFAULT_TARGET_SET: Set<KotlinTarget> = values().filter { it.isDefault }.toSet()
public val ALL_TARGET_SET: Set<AnnotationTarget> = values().toSet() public val ALL_TARGET_SET: Set<KotlinTarget> = values().toSet()
} }
} }
@@ -20,7 +20,7 @@ import com.intellij.codeInsight.NullableNotNullManager
import com.intellij.openapi.util.text.StringUtil import com.intellij.openapi.util.text.StringUtil
import com.intellij.psi.* import com.intellij.psi.*
import com.intellij.psi.javadoc.PsiDocTag import com.intellij.psi.javadoc.PsiDocTag
import org.jetbrains.kotlin.descriptors.annotations.AnnotationTarget import org.jetbrains.kotlin.descriptors.annotations.KotlinTarget
import org.jetbrains.kotlin.j2k.ast.* import org.jetbrains.kotlin.j2k.ast.*
import org.jetbrains.kotlin.j2k.ast.Annotation import org.jetbrains.kotlin.j2k.ast.Annotation
import org.jetbrains.kotlin.load.java.components.JavaAnnotationTargetMapper import org.jetbrains.kotlin.load.java.components.JavaAnnotationTargetMapper
@@ -96,7 +96,7 @@ class AnnotationConverter(private val converter: Converter) {
PsiModifier.TRANSIENT to "transient" PsiModifier.TRANSIENT to "transient"
) )
private fun mapTargetByName(expr: PsiReferenceExpression): Set<AnnotationTarget> { private fun mapTargetByName(expr: PsiReferenceExpression): Set<KotlinTarget> {
return expr.referenceName?.let { JavaAnnotationTargetMapper.mapJavaTargetArgumentByName(it) } ?: emptySet() return expr.referenceName?.let { JavaAnnotationTargetMapper.mapJavaTargetArgumentByName(it) } ?: emptySet()
} }
@@ -108,9 +108,9 @@ class AnnotationConverter(private val converter: Converter) {
} }
if (qualifiedName == CommonClassNames.JAVA_LANG_ANNOTATION_TARGET) { if (qualifiedName == CommonClassNames.JAVA_LANG_ANNOTATION_TARGET) {
val attributes = annotation.parameterList.attributes val attributes = annotation.parameterList.attributes
val arguments: Set<AnnotationTarget> val arguments: Set<KotlinTarget>
if (attributes.isEmpty()) { if (attributes.isEmpty()) {
arguments = setOf<AnnotationTarget>() arguments = setOf<KotlinTarget>()
} }
else { else {
val value = attributes[0].value val value = attributes[0].value
@@ -119,7 +119,7 @@ class AnnotationConverter(private val converter: Converter) {
.flatMap { mapTargetByName(it) } .flatMap { mapTargetByName(it) }
.toSet() .toSet()
is PsiReferenceExpression -> mapTargetByName(value) is PsiReferenceExpression -> mapTargetByName(value)
else -> setOf<AnnotationTarget>() else -> setOf<KotlinTarget>()
} }
} }
val deferredExpressionList = arguments.map { val deferredExpressionList = arguments.map {