aboutsummaryrefslogtreecommitdiff
path: root/src/Kotlin/DocumentationBuilder.kt
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-02-25 20:06:16 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-02-25 20:06:16 +0100
commitfc70184fee01430ed9c673336026c6ede8bff5f3 (patch)
tree3c74d1b878ebd55d2252f165eee21f01cc9d8ade /src/Kotlin/DocumentationBuilder.kt
parent184a24c93e0939c5a9ceb10cf3c3992f11165219 (diff)
downloaddokka-fc70184fee01430ed9c673336026c6ede8bff5f3.tar.gz
dokka-fc70184fee01430ed9c673336026c6ede8bff5f3.tar.bz2
dokka-fc70184fee01430ed9c673336026c6ede8bff5f3.zip
working test for cross-language links in documentation (Kotlin class extends Java class)
Diffstat (limited to 'src/Kotlin/DocumentationBuilder.kt')
-rw-r--r--src/Kotlin/DocumentationBuilder.kt15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index 693f2675..1d7589a5 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -101,10 +101,10 @@ class DocumentationBuilder(val session: ResolveSession,
fun resolveContentLink(descriptor: DeclarationDescriptor, href: String): ContentBlock {
val symbols = resolveKDocLink(session, descriptor, null, href.split('.').toList())
+ val symbol = findTargetSymbol(symbols)
// don't include unresolved links in generated doc
// assume that if an href doesn't contain '/', it's not an attempt to reference an external file
- if (symbols.isNotEmpty()) {
- val symbol = symbols.first()
+ if (symbol != null) {
return ContentNodeLazyLink(href, {() -> refGraph.lookup(symbol.signature()) })
}
if ("/" in href) {
@@ -113,6 +113,17 @@ class DocumentationBuilder(val session: ResolveSession,
return ContentExternalLink("#")
}
+ fun findTargetSymbol(symbols: Collection<DeclarationDescriptor>): DeclarationDescriptor? {
+ if (symbols.isEmpty()) {
+ return null
+ }
+ val symbol = symbols.first()
+ if (symbol is CallableMemberDescriptor && symbol.getKind() == CallableMemberDescriptor.Kind.FAKE_OVERRIDE) {
+ return symbol.getOverriddenDescriptors().firstOrNull()
+ }
+ return symbol
+ }
+
fun KDocSection.getTags(): Array<KDocTag> = PsiTreeUtil.getChildrenOfType(this, javaClass<KDocTag>()) ?: array()
private fun Content.addTagToSeeAlso(descriptor: DeclarationDescriptor, seeTag: KDocTag) {