diff options
author | Ignat Beresnev <ignat.beresnev@jetbrains.com> | 2022-03-30 14:55:51 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-30 14:55:51 +0300 |
commit | cab4eb11ca5203af3b229aee11111c603cd563fe (patch) | |
tree | 1db3cc81a1b6e14787e5c0e7c695a8a169f8d0ae /plugins/base/src/main/kotlin/translators | |
parent | 42aeb063ce0d717926bcfb85ab09d1a5f23e0451 (diff) | |
download | dokka-cab4eb11ca5203af3b229aee11111c603cd563fe.tar.gz dokka-cab4eb11ca5203af3b229aee11111c603cd563fe.tar.bz2 dokka-cab4eb11ca5203af3b229aee11111c603cd563fe.zip |
Fix type parameter annotation regression (#2388) (#2410)
Diffstat (limited to 'plugins/base/src/main/kotlin/translators')
-rw-r--r-- | plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt index 7acf735a..4b2d7720 100644 --- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt @@ -209,7 +209,13 @@ class DefaultPsiToDocumentableTranslator( return AncestryNode( typeConstructor = GenericTypeConstructor( DRI.from(psiClass), - psiClass.typeParameters.map(::getProjection) + psiClass.typeParameters.map { typeParameter -> + TypeParameter( + dri = DRI.from(typeParameter), + name = typeParameter.name.orEmpty(), + extra = typeParameter.annotations() + ) + } ), superclass = classes.singleOrNull()?.first?.let(::traversePsiClassForAncestorsAndInheritedMembers), interfaces = interfaces.map { traversePsiClassForAncestorsAndInheritedMembers(it.first) } @@ -439,20 +445,19 @@ class DefaultPsiToDocumentableTranslator( PropertyContainer.withAll(annotations.toSourceSetDependent().toAnnotations()) } ?: PropertyContainer.empty() - private fun getProjection(type: PsiTypeParameter) = - TypeParameter( - dri = DRI.from(type), - name = type.name.orEmpty(), - extra = type.annotations() - ) - private fun getBound(type: PsiType): Bound { fun bound() = when (type) { is PsiClassReferenceType -> type.resolve()?.let { resolved -> when { resolved.qualifiedName == "java.lang.Object" -> JavaObject(type.annotations()) - resolved is PsiTypeParameter -> getProjection(resolved) + resolved is PsiTypeParameter -> { + TypeParameter( + dri = DRI.from(resolved), + name = resolved.name.orEmpty(), + extra = type.annotations() + ) + } Regex("kotlin\\.jvm\\.functions\\.Function.*").matches(resolved.qualifiedName ?: "") || Regex("java\\.util\\.function\\.Function.*").matches( resolved.qualifiedName ?: "" |