From 63823e14794136c23359aab9f40b8d8dcfe504dd Mon Sep 17 00:00:00 2001 From: Marcin Aman Date: Tue, 7 Jul 2020 15:45:32 +0200 Subject: Javadoc signature provider (#1041) Javadoc signature provider #1025 --- .../base/src/main/kotlin/signatures/JvmSignatureUtils.kt | 3 --- .../translators/psi/DefaultPsiToDocumentableTranslator.kt | 15 ++++++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'plugins/base/src') diff --git a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt index 2a242948..689f6db5 100644 --- a/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt +++ b/plugins/base/src/main/kotlin/signatures/JvmSignatureUtils.kt @@ -21,9 +21,6 @@ interface JvmSignatureUtils { fun WithExtraProperties.annotations(): SourceSetDependent> = extra[Annotations]?.content ?: emptyMap() - private fun Annotations.Annotation.toSignatureString(): String = - "@" + this.dri.classNames + "(" + this.params.entries.joinToString { it.key + "=" + it.value } + ")" - private fun PageContentBuilder.DocumentableContentBuilder.annotations( d: Documentable, ignored: Set, diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt index 5a55e3ec..5e03be6e 100644 --- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt @@ -317,10 +317,15 @@ class DefaultPsiToDocumentableTranslator( is PsiClassReferenceType -> { val resolved: PsiClass = type.resolve() ?: return UnresolvedBound(type.presentableText) - if (resolved.qualifiedName == "java.lang.Object") { - JavaObject - } else { - TypeConstructor(DRI.from(resolved), type.parameters.map { getProjection(it) }) + when { + resolved.qualifiedName == "java.lang.Object" -> JavaObject + resolved is PsiTypeParameter && resolved.owner != null -> + OtherParameter( + declarationDRI = DRI.from(resolved.owner!!), + name = resolved.name.orEmpty() + ) + else -> + TypeConstructor(DRI.from(resolved), type.parameters.map { getProjection(it) }) } } is PsiArrayType -> TypeConstructor( @@ -443,7 +448,7 @@ class DefaultPsiToDocumentableTranslator( attributes.filter { it !is KtLightAbstractAnnotation }.mapNotNull { it.attributeName to it.toValue() } .toMap(), (psiElement as PsiClass).annotations.any { - hasQualifiedName("java.lang.annotation.Documented") + it.hasQualifiedName("java.lang.annotation.Documented") } ) } -- cgit