aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-02-22 14:31:12 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-02-22 14:31:12 +0300
commitf37d9c3bdd91c5af683eb7eaaf242d7af3d6fcf1 (patch)
treeb9039596c118469ef4f9151eee195a50c0cac4f1 /core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt
parent79a7a136bdc3a59d7bb3aebb51e565b58e2b789c (diff)
parent3eb23215edcd1cf92966f8d39afe754fef0c7a19 (diff)
downloaddokka-f37d9c3bdd91c5af683eb7eaaf242d7af3d6fcf1.tar.gz
dokka-f37d9c3bdd91c5af683eb7eaaf242d7af3d6fcf1.tar.bz2
dokka-f37d9c3bdd91c5af683eb7eaaf242d7af3d6fcf1.zip
Merge branch 'dev'
Diffstat (limited to 'core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt')
-rw-r--r--core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt22
1 files changed, 20 insertions, 2 deletions
diff --git a/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt b/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt
index 2b085769..ffef399d 100644
--- a/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt
+++ b/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt
@@ -1,16 +1,21 @@
package org.jetbrains.dokka
import com.google.inject.Inject
+import org.jetbrains.dokka.Model.DescriptorSignatureProvider
import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor
import org.jetbrains.kotlin.descriptors.DeclarationDescriptor
+import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor
import org.jetbrains.kotlin.idea.kdoc.resolveKDocLink
+import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyPrivateApi
+import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyPublicApi
class DeclarationLinkResolver
@Inject constructor(val resolutionFacade: DokkaResolutionFacade,
val refGraph: NodeReferenceGraph,
val logger: DokkaLogger,
val options: DocumentationOptions,
- val externalDocumentationLinkResolver: ExternalDocumentationLinkResolver) {
+ val externalDocumentationLinkResolver: ExternalDocumentationLinkResolver,
+ val descriptorSignatureProvider: DescriptorSignatureProvider) {
fun tryResolveContentLink(fromDescriptor: DeclarationDescriptor, href: String): ContentBlock? {
@@ -29,7 +34,17 @@ class DeclarationLinkResolver
if (externalHref != null) {
return ContentExternalLink(externalHref)
}
- return ContentNodeLazyLink(href, { -> refGraph.lookupOrWarn(symbol.signature(), logger) })
+ val signature = descriptorSignatureProvider.signature(symbol)
+ val referencedAt = fromDescriptor.signatureWithSourceLocation()
+
+ return ContentNodeLazyLink(href, { ->
+ val target = refGraph.lookup(signature)
+
+ if (target == null) {
+ logger.warn("Can't find node by signature $signature, referenced at $referencedAt")
+ }
+ target
+ })
}
if ("/" in href) {
return ContentExternalLink(href)
@@ -51,6 +66,9 @@ class DeclarationLinkResolver
if (symbol is CallableMemberDescriptor && symbol.kind == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) {
return symbol.overriddenDescriptors.firstOrNull()
}
+ if (symbol is TypeAliasDescriptor && !symbol.isDocumented(options)) {
+ return symbol.classDescriptor
+ }
return symbol
}