diff options
| author | android-build-prod (mdb) <android-build-team-robot@google.com> | 2020-04-09 00:40:16 +0000 |
|---|---|---|
| committer | android-build-prod (mdb) <android-build-team-robot@google.com> | 2020-04-09 00:40:16 +0000 |
| commit | 1a159a1d570d64ab3244e9be338e039680d886a0 (patch) | |
| tree | 580e933c47f4ad296cf33a21c494e7f76fdf6e37 | |
| parent | 49fc8d9d8ca27a173e9030d0a74880443c8f8740 (diff) | |
| parent | 3e1d8d610165da51d26f127f92e609db4af65887 (diff) | |
| download | platform_external_dokka-androidx-customview-release.tar.gz platform_external_dokka-androidx-customview-release.tar.bz2 platform_external_dokka-androidx-customview-release.zip | |
Snap for 6373271 from 3e1d8d610165da51d26f127f92e609db4af65887 to androidx-customview-releaseandroidx-customview-release
Change-Id: I3d62b93f2e87a9acbc06b6946c54615379bc2c44
| -rw-r--r-- | core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt | 14 | ||||
| -rw-r--r-- | core/testdata/format/dac/inheritedMethods/dac-as-java/Child.html | 29 | ||||
| -rw-r--r-- | gradle.properties | 2 |
3 files changed, 43 insertions, 2 deletions
diff --git a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt index ed4d3668..8776da4c 100644 --- a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt +++ b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt @@ -209,8 +209,20 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder { superTypes.filter { !ignoreSupertype(it) }.forEach { superType -> node.appendType(superType, NodeKind.Supertype) val superClass = superType.resolve() - if (superClass != null) { + // parentNode is the actual DocumentationNode of this class's supertype + // It is necessary to create documentation links back to the superclass from inherited methods + val parentNode = refGraph.lookup(superType.typeSignature()) + if (superClass != null && parentNode != null) { link(superClass, node, RefKind.Inheritor) + // Explicitly add the methods of the superclass (which are not overridden) as nodes to this class + val overriddenMethods = methods.toList().flatMap { it.findSuperMethods().toList() } + val inheritedMethods = superClass.methods.filter { it !in overriddenMethods }.toTypedArray() + + node.appendChildren(inheritedMethods, RefKind.InheritedMember) { + val child = build() + child.addReferenceTo(parentNode, RefKind.Owner) + return@appendChildren child + } } } diff --git a/core/testdata/format/dac/inheritedMethods/dac-as-java/Child.html b/core/testdata/format/dac/inheritedMethods/dac-as-java/Child.html index a66d0bf6..65e2addb 100644 --- a/core/testdata/format/dac/inheritedMethods/dac-as-java/Child.html +++ b/core/testdata/format/dac/inheritedMethods/dac-as-java/Child.html @@ -60,6 +60,35 @@ </tr> </tbody> </table> + <table class="responsive" id="inhmethods"> + <tbody> + <tr> + <th colSpan="2"> + <devsite-heading ds-is="heading" text="Inherited functions" id="inherited-functions" level="h3" toc="" class=""> + <h3 is-upgraded="">Inherited functions</h3> + </devsite-heading> + </th> + </tr> + <tr class="api apilevel-"> + <td colSpan="2"> + <div class="expandable jd-inherited-apis"><span class="expand-control exw-expanded">From class <code><a href="Parent.html#">Parent</a></code></span> + <table class="responsive exw-expanded-content"> + <tbody> + <tr class="api apilevel-" data-version-added="ApiLevel:"> + <td><code><span class="identifier">void</span></code></td> + <td width="100%"><code><a href="Parent.html#foo()">foo</a>()</code> + <p> + <p>Do a superclass foo</p> + </p> + </td> + </tr> + </tbody> + </table> + </div> + </td> + </tr> + </tbody> + </table> <h2>Public constructors</h2> <a name="Child()"></a> <div class="api apilevel-" data-version-added=""> diff --git a/gradle.properties b/gradle.properties index 79056aa4..4c10991b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -dokka_version=0.9.17-g010 +dokka_version=0.9.17-g009 dokka_publication_channel=dokka #Kotlin compiler and plugin |
