diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-03-25 15:51:51 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-03-25 15:58:37 +0100 |
commit | 40c3650b2e51d06a10ba204c79ca5c94d390a513 (patch) | |
tree | c834da7008e3dfdb5cea43a5765ccf80f5774c65 /plugins/base/src/main/kotlin/translators/psi | |
parent | af9d525d75a517a5a7cb39d30fd4b2c9e8b93837 (diff) | |
download | dokka-40c3650b2e51d06a10ba204c79ca5c94d390a513.tar.gz dokka-40c3650b2e51d06a10ba204c79ca5c94d390a513.tar.bz2 dokka-40c3650b2e51d06a10ba204c79ca5c94d390a513.zip |
Introduce VoidObject and JavaObject
Diffstat (limited to 'plugins/base/src/main/kotlin/translators/psi')
-rw-r--r-- | plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt index 74a6a7ea..218f8c82 100644 --- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt @@ -223,7 +223,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator { javadocParser.parseDocumentation(psi).toPlatformDependant(), PsiDocumentableSource(psi).toPlatformDependant(), psi.getVisibility().toPlatformDependant(), - psi.returnType?.let { getBound(type = it) } ?: VoidBound, + psi.returnType?.let { getBound(type = it) } ?: Void, psi.mapTypeParameters(dri), null, psi.getModifier(), @@ -254,14 +254,17 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator { is PsiClassReferenceType -> { val resolved: PsiClass = type.resolve() ?: throw IllegalStateException("${type.presentableText} cannot be resolved") - val arguments = type.parameters.map { getProjection(it) } - TypeConstructor(DRI.from(resolved), arguments) + if (resolved.qualifiedName == "java.lang.Object") { + JavaObject + } else { + TypeConstructor(DRI.from(resolved), type.parameters.map { getProjection(it) }) + } } is PsiArrayType -> TypeConstructor( DRI("kotlin", "Array"), listOf(getProjection(type.componentType)) ) - is PsiPrimitiveType -> PrimitiveJavaType(type.name) + is PsiPrimitiveType -> if(type.name == "void") Void else PrimitiveJavaType(type.name) else -> throw IllegalStateException("${type.presentableText} is not supported by PSI parser") } } @@ -287,12 +290,7 @@ object DefaultPsiToDocumentableTranslator : PsiToDocumentableTranslator { private fun PsiTypeParameterListOwner.mapTypeParameters(dri: DRI): List<DTypeParameter> { fun mapBounds(bounds: Array<JvmReferenceType>): List<Bound> = if (bounds.isEmpty()) emptyList() else bounds.mapNotNull { - (it as? PsiClassType)?.let { classType -> - val resolved = classType.resolve()!! - val dri = if (resolved.qualifiedName == "java.lang.Object") DriOfAny - else DRI.from(resolved) - Nullable(TypeConstructor(dri, emptyList())) - } + (it as? PsiClassType)?.let { classType -> Nullable(getBound(classType)) } } return typeParameters.mapIndexed { index, type -> DTypeParameter( |