From d6ba6677cff2de399b8231127325af2cea210b50 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 22 Mar 2018 23:12:56 +0300 Subject: Fix external references to Java enum entries Fix #274 --- core/src/main/kotlin/Kotlin/ExternalDocumentationLinkResolver.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'core/src/main') 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 -- cgit