diff options
-rw-r--r-- | core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt | 5 | ||||
-rw-r--r-- | core/src/test/kotlin/format/MarkdownFormatTest.kt | 5 | ||||
-rw-r--r-- | core/testdata/format/enumRef.kt | 4 | ||||
-rw-r--r-- | core/testdata/format/enumRef.md | 8 |
4 files changed, 21 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( diff --git a/core/testdata/format/enumRef.kt b/core/testdata/format/enumRef.kt new file mode 100644 index 00000000..5c0b2de9 --- /dev/null +++ b/core/testdata/format/enumRef.kt @@ -0,0 +1,4 @@ +/** + * [java.math.RoundingMode.UP] + */ +fun f() {}
\ No newline at end of file diff --git a/core/testdata/format/enumRef.md b/core/testdata/format/enumRef.md new file mode 100644 index 00000000..8b2a6650 --- /dev/null +++ b/core/testdata/format/enumRef.md @@ -0,0 +1,8 @@ +[test](index.md) / [f](./f.md) + +# f + +`fun f(): Unit` + +[java.math.RoundingMode.UP](http://docs.oracle.com/javase/6/docs/api/java/math/RoundingMode.html#UP) + |