Skip to content

Commit

Permalink
Refactor translating a class annotation value
Browse files Browse the repository at this point in the history
  • Loading branch information
vmishenev committed May 8, 2024
1 parent 52c4f73 commit d61f7c7
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,17 @@ internal class AnnotationTranslator {

is KtArrayAnnotationValue -> ArrayValue(annotationValue.values.map { toDokkaAnnotationValue(it) })
is KtAnnotationApplicationValue -> AnnotationValue(toDokkaAnnotation(annotationValue.annotationValue))
is KtKClassAnnotationValue.KtNonLocalKClassAnnotationValue -> ClassValue(
annotationValue.classId.relativeClassName.asString(),
annotationValue.classId.createDRI()
)

is KtKClassAnnotationValue.KtLocalKClassAnnotationValue -> throw IllegalStateException("Unexpected a local class in annotation")
is KtKClassAnnotationValue.KtErrorClassAnnotationValue -> ClassValue(
annotationValue.unresolvedQualifierName ?: "",
is KtKClassAnnotationValue -> annotationValue.classId?.let { classId ->
ClassValue(
classId.relativeClassName.asString(),
classId.createDRI()
)
} ?: ClassValue(
annotationValue.type.asStringForDebugging(),
DRI(packageName = "", classNames = ERROR_CLASS_NAME)
)

KtUnsupportedAnnotationValue -> ClassValue(
is KtUnsupportedAnnotationValue -> ClassValue(
"<Unsupported Annotation Value>",
DRI(packageName = "", classNames = ERROR_CLASS_NAME)
)
Expand Down

0 comments on commit d61f7c7

Please sign in to comment.