diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-06-17 13:48:01 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-06-17 14:01:04 +0200 |
commit | cabb4ae863ae41799ef8c11c5a2a1ef7fc34d22b (patch) | |
tree | d73a1d9dc52b129500bfbbe7ad7ecc822624b6bd | |
parent | d9c12f5da3d74a9d58bec1ffd755410b845d34d1 (diff) | |
download | dokka-cabb4ae863ae41799ef8c11c5a2a1ef7fc34d22b.tar.gz dokka-cabb4ae863ae41799ef8c11c5a2a1ef7fc34d22b.tar.bz2 dokka-cabb4ae863ae41799ef8c11c5a2a1ef7fc34d22b.zip |
Add UnresolvedBound instead of throwing an exception
5 files changed, 5 insertions, 1 deletions
diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index feab34c5..17b49f97 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -360,6 +360,7 @@ data class PrimitiveJavaType(val name: String) : Bound() object Void : Bound() object JavaObject : Bound() object Dynamic : Bound() +data class UnresolvedBound(val name: String): Bound() enum class FunctionModifiers { NONE, FUNCTION, EXTENSION diff --git a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt index a444d192..3b00320c 100644 --- a/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt +++ b/plugins/base/src/main/kotlin/signatures/KotlinSignatureProvider.kt @@ -244,6 +244,7 @@ class KotlinSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLog is Void -> link("Unit", DriOfUnit) is PrimitiveJavaType -> signatureForProjection(p.translateToKotlin()) is Dynamic -> text("dynamic") + is UnresolvedBound -> text(p.name) } private fun funType(dri: DRI, sourceSets: Set<SourceSetData>, type: TypeConstructor) = diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt index a5fa4189..6ec5c4f5 100644 --- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt +++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt @@ -303,7 +303,7 @@ object DefaultPsiToDocumentableTranslator : SourceToDocumentableTranslator { when (type) { is PsiClassReferenceType -> { val resolved: PsiClass = type.resolve() - ?: throw IllegalStateException("${type.presentableText} cannot be resolved") + ?: return UnresolvedBound(type.presentableText) if (resolved.qualifiedName == "java.lang.Object") { JavaObject } else { diff --git a/plugins/base/src/test/kotlin/utils/TestUtils.kt b/plugins/base/src/test/kotlin/utils/TestUtils.kt index 1591f4f7..44c23e96 100644 --- a/plugins/base/src/test/kotlin/utils/TestUtils.kt +++ b/plugins/base/src/test/kotlin/utils/TestUtils.kt @@ -74,4 +74,5 @@ val Bound.name: String? is JavaObject -> "Object" is Void -> "void" is Dynamic -> "dynamic" + is UnresolvedBound -> "<ERROR CLASS>" }
\ No newline at end of file diff --git a/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt b/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt index 5c4985ac..0eb25504 100644 --- a/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt +++ b/plugins/kotlin-as-java/src/main/kotlin/signatures/JavaSignatureProvider.kt @@ -129,5 +129,6 @@ class JavaSignatureProvider(ctcc: CommentsToContentConverter, logger: DokkaLogge is JavaObject, is Dynamic -> link("Object", DRI("java.lang", "Object")) is Void -> text("void") is PrimitiveJavaType -> text(p.name) + is UnresolvedBound -> text(p.name) } }
\ No newline at end of file |