diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2018-03-22 23:12:56 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2018-03-23 13:59:07 +0300 |
commit | d6ba6677cff2de399b8231127325af2cea210b50 (patch) | |
tree | ecb7acc17fb71a4d6a214a8908edf7abd732e3f6 /core/src | |
parent | b9f4b81092b492c1519f9d16fb7511b78d20d17d (diff) | |
download | dokka-d6ba6677cff2de399b8231127325af2cea210b50.tar.gz dokka-d6ba6677cff2de399b8231127325af2cea210b50.tar.bz2 dokka-d6ba6677cff2de399b8231127325af2cea210b50.zip |
Fix external references to Java enum entries
Fix #274
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt | 5 | ||||
-rw-r--r-- | core/src/test/kotlin/format/MarkdownFormatTest.kt | 5 |
2 files changed, 9 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt b/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt index 108cee78..ebea7183 100644 --- a/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt +++ b/core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt @@ -5,6 +5,7 @@ import com.google.inject.Singleton import com.intellij.psi.PsiMethod import com.intellij.util.io.* import org.jetbrains.kotlin.descriptors.* +import org.jetbrains.kotlin.descriptors.impl.EnumEntrySyntheticClassDescriptor import org.jetbrains.kotlin.load.java.descriptors.JavaCallableMemberDescriptor import org.jetbrains.kotlin.load.java.descriptors.JavaClassDescriptor import org.jetbrains.kotlin.load.java.descriptors.JavaMethodDescriptor @@ -178,7 +179,9 @@ interface InboundExternalLinkResolutionService { class Javadoc : InboundExternalLinkResolutionService { override fun getPath(symbol: DeclarationDescriptor): String? { - if (symbol is JavaClassDescriptor) { + if (symbol is EnumEntrySyntheticClassDescriptor) { + return getPath(symbol.containingDeclaration)?.let { it + "#" + symbol.name.asString() } + } else if (symbol is JavaClassDescriptor) { return DescriptorUtils.getFqName(symbol).asString().replace(".", "/") + ".html" } else if (symbol is JavaCallableMemberDescriptor) { val containingClass = symbol.containingDeclaration as? JavaClassDescriptor ?: return null diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index f60969fc..f06f0e64 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -419,6 +419,11 @@ class MarkdownFormatTest: FileGeneratorTestCase() { verifyMarkdownNodeByName("companionImplements", "Foo") } + @Test fun enumRef() { + verifyMarkdownNode("enumRef") + } + + private fun buildMultiplePlatforms(path: String): DocumentationModule { val module = DocumentationModule("test") val options = DocumentationOptions( |