diff options
38 files changed, 113 insertions, 122 deletions
diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 9700d3cc..fb727eec 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -40,6 +40,26 @@ <module name="integration_test" target="1.8" /> <module name="maven-plugin_main" target="1.8" /> <module name="maven-plugin_test" target="1.8" /> + <module name="org.jetbrains.dokka.android-gradle-plugin.main" target="1.8" /> + <module name="org.jetbrains.dokka.android-gradle-plugin.test" target="1.8" /> + <module name="org.jetbrains.dokka.ant.main" target="1.8" /> + <module name="org.jetbrains.dokka.ant.test" target="1.8" /> + <module name="org.jetbrains.dokka.buildSrc.main" target="1.8" /> + <module name="org.jetbrains.dokka.buildSrc.test" target="1.8" /> + <module name="org.jetbrains.dokka.cli.main" target="1.8" /> + <module name="org.jetbrains.dokka.cli.test" target="1.8" /> + <module name="org.jetbrains.dokka.core.main" target="1.8" /> + <module name="org.jetbrains.dokka.core.test" target="1.8" /> + <module name="org.jetbrains.dokka.fatjar.main" target="1.8" /> + <module name="org.jetbrains.dokka.fatjar.test" target="1.8" /> + <module name="org.jetbrains.dokka.gradle-integration-tests.main" target="1.8" /> + <module name="org.jetbrains.dokka.gradle-integration-tests.test" target="1.8" /> + <module name="org.jetbrains.dokka.gradle-plugin.main" target="1.8" /> + <module name="org.jetbrains.dokka.gradle-plugin.test" target="1.8" /> + <module name="org.jetbrains.dokka.integration.main" target="1.8" /> + <module name="org.jetbrains.dokka.integration.test" target="1.8" /> + <module name="org.jetbrains.dokka.maven-plugin.main" target="1.8" /> + <module name="org.jetbrains.dokka.maven-plugin.test" target="1.8" /> </bytecodeTargetLevel> </component> </project>
\ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index b072dc00..38d23597 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -6,6 +6,6 @@ </component> <component name="KotlinCommonCompilerArguments"> <option name="apiVersion" value="1.1" /> - <option name="languageVersion" value="1.1" /> + <option name="languageVersion" value="1.2" /> </component> </project>
\ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml index 7e6aaef5..3c92c5db 100644 --- a/.idea/modules.xml +++ b/.idea/modules.xml @@ -2,38 +2,38 @@ <project version="4"> <component name="ProjectModuleManager"> <modules> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/android-gradle-plugin/android-gradle-plugin.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/android-gradle-plugin/android-gradle-plugin.iml" group="runners/android-gradle-plugin" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/android-gradle-plugin/android-gradle-plugin_main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/android-gradle-plugin/android-gradle-plugin_main.iml" group="runners/android-gradle-plugin" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/android-gradle-plugin/android-gradle-plugin_test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/android-gradle-plugin/android-gradle-plugin_test.iml" group="runners/android-gradle-plugin" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/ant/ant.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/ant/ant.iml" group="runners/ant" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/ant/ant_main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/ant/ant_main.iml" group="runners/ant" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/ant/ant_test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/ant/ant_test.iml" group="runners/ant" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/buildSrc.iml" filepath="$PROJECT_DIR$/.idea/modules/buildSrc.iml" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/buildSrc_main.iml" filepath="$PROJECT_DIR$/.idea/modules/buildSrc_main.iml" group="buildSrc" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/buildSrc_test.iml" filepath="$PROJECT_DIR$/.idea/modules/buildSrc_test.iml" group="buildSrc" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/cli/cli.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/cli/cli.iml" group="runners/cli" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/cli/cli_main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/cli/cli_main.iml" group="runners/cli" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/cli/cli_test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/cli/cli_test.iml" group="runners/cli" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/core/core.iml" filepath="$PROJECT_DIR$/.idea/modules/core/core.iml" group="core" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/core/core_main.iml" filepath="$PROJECT_DIR$/.idea/modules/core/core_main.iml" group="core" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/core/core_test.iml" filepath="$PROJECT_DIR$/.idea/modules/core/core_test.iml" group="core" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/dokka.iml" filepath="$PROJECT_DIR$/.idea/modules/dokka.iml" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/fatjar/fatjar.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/fatjar/fatjar.iml" group="runners/fatjar" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/fatjar/fatjar_main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/fatjar/fatjar_main.iml" group="runners/fatjar" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/fatjar/fatjar_test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/fatjar/fatjar_test.iml" group="runners/fatjar" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/gradle-integration-tests/gradle-integration-tests.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/gradle-integration-tests/gradle-integration-tests.iml" group="runners/gradle-integration-tests" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/gradle-integration-tests/gradle-integration-tests_main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/gradle-integration-tests/gradle-integration-tests_main.iml" group="runners/gradle-integration-tests" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/gradle-integration-tests/gradle-integration-tests_test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/gradle-integration-tests/gradle-integration-tests_test.iml" group="runners/gradle-integration-tests" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/gradle-plugin/gradle-plugin.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/gradle-plugin/gradle-plugin.iml" group="runners/gradle-plugin" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/gradle-plugin/gradle-plugin_main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/gradle-plugin/gradle-plugin_main.iml" group="runners/gradle-plugin" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/gradle-plugin/gradle-plugin_test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/gradle-plugin/gradle-plugin_test.iml" group="runners/gradle-plugin" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/integration/integration.iml" filepath="$PROJECT_DIR$/.idea/modules/integration/integration.iml" group="integration" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/integration/integration_main.iml" filepath="$PROJECT_DIR$/.idea/modules/integration/integration_main.iml" group="integration" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/integration/integration_test.iml" filepath="$PROJECT_DIR$/.idea/modules/integration/integration_test.iml" group="integration" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/maven-plugin/maven-plugin.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/maven-plugin/maven-plugin.iml" group="runners/maven-plugin" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/maven-plugin/maven-plugin_main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/maven-plugin/maven-plugin_main.iml" group="runners/maven-plugin" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/maven-plugin/maven-plugin_test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/maven-plugin/maven-plugin_test.iml" group="runners/maven-plugin" /> - <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/runners.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/runners.iml" group="runners" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/android-gradle-plugin/org.jetbrains.dokka.android-gradle-plugin.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/android-gradle-plugin/org.jetbrains.dokka.android-gradle-plugin.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/android-gradle-plugin/org.jetbrains.dokka.android-gradle-plugin.main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/android-gradle-plugin/org.jetbrains.dokka.android-gradle-plugin.main.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/android-gradle-plugin/org.jetbrains.dokka.android-gradle-plugin.test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/android-gradle-plugin/org.jetbrains.dokka.android-gradle-plugin.test.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/ant/org.jetbrains.dokka.ant.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/ant/org.jetbrains.dokka.ant.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/ant/org.jetbrains.dokka.ant.main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/ant/org.jetbrains.dokka.ant.main.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/ant/org.jetbrains.dokka.ant.test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/ant/org.jetbrains.dokka.ant.test.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/org.jetbrains.dokka.buildSrc.iml" filepath="$PROJECT_DIR$/.idea/modules/org.jetbrains.dokka.buildSrc.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/org.jetbrains.dokka.buildSrc.main.iml" filepath="$PROJECT_DIR$/.idea/modules/org.jetbrains.dokka.buildSrc.main.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/org.jetbrains.dokka.buildSrc.test.iml" filepath="$PROJECT_DIR$/.idea/modules/org.jetbrains.dokka.buildSrc.test.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/cli/org.jetbrains.dokka.cli.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/cli/org.jetbrains.dokka.cli.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/cli/org.jetbrains.dokka.cli.main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/cli/org.jetbrains.dokka.cli.main.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/cli/org.jetbrains.dokka.cli.test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/cli/org.jetbrains.dokka.cli.test.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/core/org.jetbrains.dokka.core.iml" filepath="$PROJECT_DIR$/.idea/modules/core/org.jetbrains.dokka.core.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/core/org.jetbrains.dokka.core.main.iml" filepath="$PROJECT_DIR$/.idea/modules/core/org.jetbrains.dokka.core.main.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/core/org.jetbrains.dokka.core.test.iml" filepath="$PROJECT_DIR$/.idea/modules/core/org.jetbrains.dokka.core.test.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/org.jetbrains.dokka.dokka.iml" filepath="$PROJECT_DIR$/.idea/modules/org.jetbrains.dokka.dokka.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/fatjar/org.jetbrains.dokka.fatjar.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/fatjar/org.jetbrains.dokka.fatjar.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/fatjar/org.jetbrains.dokka.fatjar.main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/fatjar/org.jetbrains.dokka.fatjar.main.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/fatjar/org.jetbrains.dokka.fatjar.test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/fatjar/org.jetbrains.dokka.fatjar.test.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/gradle-integration-tests/org.jetbrains.dokka.gradle-integration-tests.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/gradle-integration-tests/org.jetbrains.dokka.gradle-integration-tests.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/gradle-integration-tests/org.jetbrains.dokka.gradle-integration-tests.main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/gradle-integration-tests/org.jetbrains.dokka.gradle-integration-tests.main.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/gradle-integration-tests/org.jetbrains.dokka.gradle-integration-tests.test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/gradle-integration-tests/org.jetbrains.dokka.gradle-integration-tests.test.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/gradle-plugin/org.jetbrains.dokka.gradle-plugin.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/gradle-plugin/org.jetbrains.dokka.gradle-plugin.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/gradle-plugin/org.jetbrains.dokka.gradle-plugin.main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/gradle-plugin/org.jetbrains.dokka.gradle-plugin.main.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/gradle-plugin/org.jetbrains.dokka.gradle-plugin.test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/gradle-plugin/org.jetbrains.dokka.gradle-plugin.test.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/integration/org.jetbrains.dokka.integration.iml" filepath="$PROJECT_DIR$/.idea/modules/integration/org.jetbrains.dokka.integration.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/integration/org.jetbrains.dokka.integration.main.iml" filepath="$PROJECT_DIR$/.idea/modules/integration/org.jetbrains.dokka.integration.main.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/integration/org.jetbrains.dokka.integration.test.iml" filepath="$PROJECT_DIR$/.idea/modules/integration/org.jetbrains.dokka.integration.test.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/maven-plugin/org.jetbrains.dokka.maven-plugin.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/maven-plugin/org.jetbrains.dokka.maven-plugin.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/maven-plugin/org.jetbrains.dokka.maven-plugin.main.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/maven-plugin/org.jetbrains.dokka.maven-plugin.main.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/maven-plugin/org.jetbrains.dokka.maven-plugin.test.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/maven-plugin/org.jetbrains.dokka.maven-plugin.test.iml" /> + <module fileurl="file://$PROJECT_DIR$/.idea/modules/runners/org.jetbrains.dokka.runners.iml" filepath="$PROJECT_DIR$/.idea/modules/runners/org.jetbrains.dokka.runners.iml" /> </modules> </component> </project>
\ No newline at end of file diff --git a/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt b/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt index 4f6a7c76..1ad68643 100644 --- a/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt +++ b/core/src/main/kotlin/Analysis/CoreProjectFileIndex.kt @@ -166,8 +166,7 @@ class CoreProjectFileIndex(private val project: Project, contentRoots: List<Cont private val sdk: Sdk = object : Sdk, RootProvider { override fun getFiles(rootType: OrderRootType): Array<out VirtualFile> = classpathRoots - .map { StandardFileSystems.local().findFileByPath(it.file.path) } - .filterNotNull() + .mapNotNull { StandardFileSystems.local().findFileByPath(it.file.path) } .toTypedArray() override fun addRootSetChangedListener(p0: RootProvider.RootSetChangedListener) { diff --git a/core/src/main/kotlin/Formats/FormatService.kt b/core/src/main/kotlin/Formats/FormatService.kt index 63f25008..8f4855e3 100644 --- a/core/src/main/kotlin/Formats/FormatService.kt +++ b/core/src/main/kotlin/Formats/FormatService.kt @@ -22,7 +22,7 @@ interface FormatService { } interface FormattedOutputBuilder { - /** Appends formatted content to [StringBuilder](to) using specified [location] */ + /** Appends formatted content */ fun appendNodes(nodes: Iterable<DocumentationNode>) } diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index 952e14cf..bd27448a 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -174,9 +174,9 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, } when (content) { is ContentBlockSampleCode -> - appendSampleBlockCode(content.language, content.importsBlock::appendBlockCodeContent, { content.appendBlockCodeContent() }) + appendSampleBlockCode(content.language, content.importsBlock::appendBlockCodeContent) { content.appendBlockCodeContent() } is ContentBlockCode -> - appendBlockCode(content.language, { content.appendBlockCodeContent() }) + appendBlockCode(content.language) { content.appendBlockCodeContent() } } } is ContentHeading -> appendHeader(content.level) { appendContent(content.children) } @@ -557,7 +557,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, if (node.kind == NodeKind.Module) { appendHeader(3) { to.append("Index") } node.members(NodeKind.AllTypes).singleOrNull()?.let { allTypes -> - appendLink(link(node, allTypes, { "All Types" })) + appendLink(link(node, allTypes) { "All Types" }) } } } diff --git a/core/src/main/kotlin/Generation/DokkaGenerator.kt b/core/src/main/kotlin/Generation/DokkaGenerator.kt index 09e5cedf..59b9dc5e 100644 --- a/core/src/main/kotlin/Generation/DokkaGenerator.kt +++ b/core/src/main/kotlin/Generation/DokkaGenerator.kt @@ -140,9 +140,7 @@ fun buildDocumentationModule(injector: Injector, val analyzer = resolutionFacade.getFrontendService(LazyTopDownAnalyzer::class.java) analyzer.analyzeDeclarations(TopDownAnalysisMode.TopLevelDeclarations, fragmentFiles) - val fragments = fragmentFiles - .map { resolutionFacade.resolveSession.getPackageFragment(it.packageFqName) } - .filterNotNull() + val fragments = fragmentFiles.mapNotNull { resolutionFacade.resolveSession.getPackageFragment(it.packageFqName) } .distinct() val packageDocs = injector.getInstance(PackageDocs::class.java) diff --git a/core/src/main/kotlin/Generation/FileGenerator.kt b/core/src/main/kotlin/Generation/FileGenerator.kt index b7c6cf63..aff07648 100644 --- a/core/src/main/kotlin/Generation/FileGenerator.kt +++ b/core/src/main/kotlin/Generation/FileGenerator.kt @@ -2,7 +2,6 @@ package org.jetbrains.dokka import com.google.inject.Inject import com.google.inject.name.Named -import org.jetbrains.kotlin.utils.fileUtils.withReplacedExtensionOrNull import java.io.File import java.io.FileOutputStream import java.io.IOException diff --git a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt index cf2b0514..624c5fdc 100644 --- a/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt +++ b/core/src/main/kotlin/Java/JavaPsiDocumentationBuilder.kt @@ -18,7 +18,7 @@ fun getSignature(element: PsiElement?) = when(element) { is PsiField -> element.containingClass!!.qualifiedName + "$" + element.name is PsiMethod -> element.containingClass!!.qualifiedName + "$" + element.name + "(" + - element.parameterList.parameters.map { it.type.typeSignature() }.joinToString(",") + ")" + element.parameterList.parameters.joinToString(",") { it.type.typeSignature() } + ")" else -> null } @@ -291,7 +291,7 @@ class JavaPsiDocumentationBuilder : JavaDocumentationBuilder { } fun hasSuppressDocTag(element: Any?): Boolean { - val declaration = (element as? KtLightDeclaration<*, *>)?.kotlinOrigin as? KtDeclaration ?: return false + val declaration = (element as? KtLightDeclaration<*, *>)?.kotlinOrigin ?: return false return PsiTreeUtil.findChildrenOfType(declaration.docComment, KDocTag::class.java).any { it.knownTag == KDocKnownTag.SUPPRESS } } diff --git a/core/src/main/kotlin/Java/JavadocParser.kt b/core/src/main/kotlin/Java/JavadocParser.kt index c25f5813..ea3a5963 100644 --- a/core/src/main/kotlin/Java/JavadocParser.kt +++ b/core/src/main/kotlin/Java/JavadocParser.kt @@ -23,8 +23,7 @@ interface JavaDocumentationParser { class JavadocParser(private val refGraph: NodeReferenceGraph, private val logger: DokkaLogger) : JavaDocumentationParser { override fun parseDocumentation(element: PsiNamedElement): JavadocParseResult { - val docComment = (element as? PsiDocCommentOwner)?.docComment - if (docComment == null) return JavadocParseResult.Empty + val docComment = (element as? PsiDocCommentOwner)?.docComment ?: return JavadocParseResult.Empty val result = MutableContent() var deprecatedContent: Content? = null val para = ContentParagraph() @@ -101,7 +100,7 @@ class JavadocParser(private val refGraph: NodeReferenceGraph, private fun createLink(element: Element): ContentBlock { val docref = element.attr("docref") if (docref != null) { - return ContentNodeLazyLink(docref, { -> refGraph.lookupOrWarn(docref, logger)}) + return ContentNodeLazyLink(docref) { refGraph.lookupOrWarn(docref, logger)} } val href = element.attr("href") if (href != null) { @@ -112,15 +111,12 @@ class JavadocParser(private val refGraph: NodeReferenceGraph, } private fun MutableContent.convertSeeTag(tag: PsiDocTag) { - val linkElement = tag.linkElement() - if (linkElement == null) { - return - } + val linkElement = tag.linkElement() ?: return val seeSection = findSectionByTag(ContentTags.SeeAlso) ?: addSection(ContentTags.SeeAlso, null) val linkSignature = resolveLink(linkElement) val text = ContentText(linkElement.text) if (linkSignature != null) { - val linkNode = ContentNodeLazyLink(tag.valueElement!!.text, { -> refGraph.lookupOrWarn(linkSignature, logger)}) + val linkNode = ContentNodeLazyLink(tag.valueElement!!.text) { refGraph.lookupOrWarn(linkSignature, logger)} linkNode.append(text) seeSection.append(linkNode) } else { diff --git a/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt b/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt index ffef399d..da2b7272 100644 --- a/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt +++ b/core/src/main/kotlin/Kotlin/DeclarationLinkResolver.kt @@ -6,8 +6,6 @@ import org.jetbrains.kotlin.descriptors.CallableMemberDescriptor import org.jetbrains.kotlin.descriptors.DeclarationDescriptor import org.jetbrains.kotlin.descriptors.TypeAliasDescriptor import org.jetbrains.kotlin.idea.kdoc.resolveKDocLink -import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyPrivateApi -import org.jetbrains.kotlin.resolve.descriptorUtil.isEffectivelyPublicApi class DeclarationLinkResolver @Inject constructor(val resolutionFacade: DokkaResolutionFacade, @@ -37,14 +35,14 @@ class DeclarationLinkResolver val signature = descriptorSignatureProvider.signature(symbol) val referencedAt = fromDescriptor.signatureWithSourceLocation() - return ContentNodeLazyLink(href, { -> + return ContentNodeLazyLink(href) { val target = refGraph.lookup(signature) if (target == null) { logger.warn("Can't find node by signature $signature, referenced at $referencedAt") } target - }) + } } if ("/" in href) { return ContentExternalLink(href) diff --git a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt index 6e44df74..4d276b5a 100644 --- a/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt +++ b/core/src/main/kotlin/Kotlin/DescriptorDocumentationParser.kt @@ -66,7 +66,7 @@ class DescriptorDocumentationParser } val tree = parseMarkdown(kdocText) val linkMap = LinkMap.buildLinkMap(tree.node, kdocText) - val content = buildContent(tree, LinkResolver(linkMap, { href -> linkResolver.resolveContentLink(contextDescriptor, href) }), inline) + val content = buildContent(tree, LinkResolver(linkMap) { href -> linkResolver.resolveContentLink(contextDescriptor, href) }, inline) if (kdoc is KDocSection) { val tags = kdoc.getTags() tags.forEach { @@ -79,7 +79,7 @@ class DescriptorDocumentationParser val section = content.addSection(javadocSectionDisplayName(it.name), it.getSubjectName()) val sectionContent = it.getContent() val markdownNode = parseMarkdown(sectionContent) - buildInlineContentTo(markdownNode, section, LinkResolver(linkMap, { href -> linkResolver.resolveContentLink(contextDescriptor, href) })) + buildInlineContentTo(markdownNode, section, LinkResolver(linkMap) { href -> linkResolver.resolveContentLink(contextDescriptor, href) }) } } } @@ -114,8 +114,8 @@ class DescriptorDocumentationParser FqName.fromSegments(listOf("kotlin", "Any")), NoLookupLocation.FROM_IDE) anyClassDescriptors.forEach { val anyMethod = (it as ClassDescriptor).getMemberScope(listOf()) - .getDescriptorsFiltered(DescriptorKindFilter.FUNCTIONS, { it == descriptor.name }) - .single() + .getDescriptorsFiltered(DescriptorKindFilter.FUNCTIONS) { it == descriptor.name } + .single() val kdoc = anyMethod.findKDoc() if (kdoc != null) { return kdoc diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt index 7b50fff5..9c726429 100644 --- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt @@ -901,11 +901,11 @@ fun DocumentationNode.getParentForPackageMember(descriptor: DeclarationDescripto if (extensionClassDescriptor != null && isExtensionForExternalClass(descriptor, extensionClassDescriptor, allFqNames) && !ErrorUtils.isError(extensionClassDescriptor)) { val fqName = DescriptorUtils.getFqNameSafe(extensionClassDescriptor) - return externalClassNodes.getOrPut(fqName, { + return externalClassNodes.getOrPut(fqName) { val newNode = DocumentationNode(fqName.asString(), Content.Empty, NodeKind.ExternalClass) append(newNode, RefKind.Member) newNode - }) + } } } return this diff --git a/core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt index c7ed8292..21c1ae0f 100644 --- a/core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt +++ b/core/src/main/kotlin/Kotlin/KotlinAsJavaDocumentationBuilder.kt @@ -40,8 +40,7 @@ class KotlinAsJavaDocumentationBuilder fun PsiClass.isVisibleInDocumentation(): Boolean { val origin: KtDeclaration = (this as KtLightElement<*, *>).kotlinOrigin as? KtDeclaration ?: return true - return origin.hasModifier(KtTokens.INTERNAL_KEYWORD) != true && - origin.hasModifier(KtTokens.PRIVATE_KEYWORD) != true + return !origin.hasModifier(KtTokens.INTERNAL_KEYWORD) && !origin.hasModifier(KtTokens.PRIVATE_KEYWORD) } } diff --git a/core/src/main/kotlin/Kotlin/KotlinLanguageService.kt b/core/src/main/kotlin/Kotlin/KotlinLanguageService.kt index f33c8c96..597002fb 100644 --- a/core/src/main/kotlin/Kotlin/KotlinLanguageService.kt +++ b/core/src/main/kotlin/Kotlin/KotlinLanguageService.kt @@ -55,7 +55,7 @@ class KotlinLanguageService : LanguageService { } private fun List<DocumentationNode>.getReceiverKind(): ReceiverKind? { - val qNames = map { it.getReceiverQName() }.filterNotNull() + val qNames = mapNotNull { it.getReceiverQName() } if (qNames.size != size) return null diff --git a/core/src/main/kotlin/Languages/JavaLanguageService.kt b/core/src/main/kotlin/Languages/JavaLanguageService.kt index 59bedd02..ad66123b 100644 --- a/core/src/main/kotlin/Languages/JavaLanguageService.kt +++ b/core/src/main/kotlin/Languages/JavaLanguageService.kt @@ -84,7 +84,7 @@ class JavaLanguageService : LanguageService { return if (constraints.none()) node.name else { - node.name + " extends " + constraints.map { renderType(node) }.joinToString() + node.name + " extends " + constraints.joinToString { renderType(node) } } } @@ -97,7 +97,7 @@ class JavaLanguageService : LanguageService { val typeParameters = node.details(NodeKind.TypeParameter) if (typeParameters.any()) { append("<") - append(typeParameters.map { renderTypeParameter(it) }.joinToString()) + append(typeParameters.joinToString { renderTypeParameter(it) }) append("> ") } }.toString() @@ -142,9 +142,9 @@ class JavaLanguageService : LanguageService { val receiver = node.details(NodeKind.Receiver).singleOrNull() append("(") if (receiver != null) - (listOf(receiver |
