From 7b4c960768ec18711c48c540f3150d05780ac92e Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Thu, 19 Mar 2015 15:21:22 +0100 Subject: protect against compiler exceptions in resolveKDocLink(): /Users/yole/jetbrains/kotlin/libraries/build-docs.xml:13: java.lang.IllegalArgumentException: invalid identifier: at org.jetbrains.kotlin.name.Name.identifier(Name.java:56) at org.jetbrains.kotlin.name.Name.guess(Name.java:86) at org.jetbrains.kotlin.name.FqNameUnsafe.compute(FqNameUnsafe.java:77) at org.jetbrains.kotlin.name.FqNameUnsafe.shortName(FqNameUnsafe.java:151) at org.jetbrains.kotlin.name.FqName.shortName(FqName.java:108) at org.jetbrains.kotlin.descriptors.impl.SubpackagesScope.getDescriptors(SubpackagesScope.kt:44) at org.jetbrains.kotlin.resolve.scopes.ChainedScope.getDescriptors(ChainedScope.kt:65) at org.jetbrains.kotlin.resolve.scopes.JetScope$$TImpl.getDescriptors$default(JetScope.kt:53) at org.jetbrains.kotlin.idea.kdoc.KdocPackage$KDocReference$7d64cd50.resolveKDocLink(KDocReference.kt:94) at org.jetbrains.kotlin.idea.kdoc.KdocPackage.resolveKDocLink(KDocReference.kt:1) at org.jetbrains.dokka.DocumentationBuilder.resolveContentLink(DocumentationBuilder.kt:174) --- src/Kotlin/DocumentationBuilder.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt index 18a1e74c..e193817a 100644 --- a/src/Kotlin/DocumentationBuilder.kt +++ b/src/Kotlin/DocumentationBuilder.kt @@ -171,8 +171,13 @@ 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) + val symbol = try { + val symbols = resolveKDocLink(session, descriptor, null, href.split('.').toList()) + findTargetSymbol(symbols) + } catch(e: Exception) { + null + } + // 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 (symbol != null) { -- cgit