Drop support of annotation(retention, repeatable, mustBeDocumented) format
This commit is contained in:
committed by
Mikhail Glukhikh
parent
eab288bdd7
commit
ccf78b6fa4
@@ -173,30 +173,16 @@ public fun ValueParameterDescriptor.hasDefaultValue(): Boolean {
|
|||||||
return handler.result()
|
return handler.result()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun Annotated.isAnnotationPropertyTrue(name: String, defaultValue: Boolean = false): Boolean {
|
|
||||||
val annotationEntryDescriptor = annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.annotation) ?: return defaultValue
|
|
||||||
val repeatableArgumentValue = annotationEntryDescriptor.allValueArguments.entrySet().firstOrNull {
|
|
||||||
name == it.key.name.asString()
|
|
||||||
}?.getValue() as? BooleanValue ?: return defaultValue
|
|
||||||
return repeatableArgumentValue.value
|
|
||||||
}
|
|
||||||
|
|
||||||
public fun Annotated.isRepeatableAnnotation(): Boolean =
|
public fun Annotated.isRepeatableAnnotation(): Boolean =
|
||||||
annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.repeatable) != null
|
annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.repeatable) != null
|
||||||
// deprecated
|
|
||||||
|| isAnnotationPropertyTrue("repeatable")
|
|
||||||
|
|
||||||
public fun Annotated.isDocumentedAnnotation(): Boolean =
|
public fun Annotated.isDocumentedAnnotation(): Boolean =
|
||||||
annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.mustBeDocumented) != null
|
annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.mustBeDocumented) != null
|
||||||
// deprecated
|
|
||||||
|| isAnnotationPropertyTrue("mustBeDocumented")
|
|
||||||
|
|
||||||
public fun Annotated.getAnnotationRetention(): KotlinRetention? {
|
public fun Annotated.getAnnotationRetention(): KotlinRetention? {
|
||||||
val annotationEntryDescriptor = annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.retention) ?:
|
val annotationEntryDescriptor = annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.retention) ?: return null
|
||||||
// deprecated
|
|
||||||
annotations.findAnnotation(KotlinBuiltIns.FQ_NAMES.annotation) ?: return null
|
|
||||||
val retentionArgumentValue = annotationEntryDescriptor.allValueArguments.entrySet().firstOrNull {
|
val retentionArgumentValue = annotationEntryDescriptor.allValueArguments.entrySet().firstOrNull {
|
||||||
it.key.name.asString() in setOf("value", "retention")
|
it.key.name.asString() == "value"
|
||||||
}?.getValue() as? EnumValue ?: return null
|
}?.getValue() as? EnumValue ?: return null
|
||||||
return KotlinRetention.valueOf(retentionArgumentValue.value.name.asString())
|
return KotlinRetention.valueOf(retentionArgumentValue.value.name.asString())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user