From 17dd9747828a2ba8275714dc421a415c68d01615 Mon Sep 17 00:00:00 2001 From: Robert Stoll Date: Fri, 22 Jun 2018 10:25:09 +0200 Subject: convert line separators in PackageDocs, fixes PackageDocsTest --- core/src/main/kotlin/Model/PackageDocs.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'core/src') diff --git a/core/src/main/kotlin/Model/PackageDocs.kt b/core/src/main/kotlin/Model/PackageDocs.kt index 1f6bdcb9..bb8e98d1 100644 --- a/core/src/main/kotlin/Model/PackageDocs.kt +++ b/core/src/main/kotlin/Model/PackageDocs.kt @@ -2,6 +2,7 @@ package org.jetbrains.dokka import com.google.inject.Inject import com.google.inject.Singleton +import com.intellij.openapi.util.text.StringUtil import org.intellij.markdown.MarkdownElementTypes import org.intellij.markdown.MarkdownTokenTypes import org.intellij.markdown.parser.LinkMap @@ -21,7 +22,7 @@ class PackageDocs fun parse(fileName: String, linkResolveContext: List) { val file = File(fileName) if (file.exists()) { - val text = file.readText() + val text = StringUtil.convertLineSeparators(file.readText()) val tree = parseMarkdown(text) val linkMap = LinkMap.buildLinkMap(tree.node, text) var targetContent: MutableContent = moduleContent @@ -51,7 +52,7 @@ class PackageDocs } private fun findOrCreatePackageContent(packageName: String) = - _packageContent.getOrPut(packageName) { -> MutableContent() } + _packageContent.getOrPut(packageName) { MutableContent() } private fun resolveContentLink(fileName: String, href: String, linkResolveContext: List): ContentBlock { if (linkResolver != null) { -- cgit From ec2dfa898b4cf2613ca15cd959a43f4f590005d3 Mon Sep 17 00:00:00 2001 From: Xerus <27jf@web.de> Date: Thu, 13 Dec 2018 17:45:46 +0100 Subject: Fix IDEA Inspections --- .idea/compiler.xml | 20 +++++++ .idea/kotlinc.xml | 2 +- .idea/modules.xml | 64 +++++++++++----------- .../main/kotlin/Analysis/CoreProjectFileIndex.kt | 3 +- core/src/main/kotlin/Formats/FormatService.kt | 2 +- .../main/kotlin/Formats/StructuredFormatService.kt | 6 +- core/src/main/kotlin/Generation/DokkaGenerator.kt | 4 +- core/src/main/kotlin/Generation/FileGenerator.kt | 1 - .../kotlin/Java/JavaPsiDocumentationBuilder.kt | 4 +- core/src/main/kotlin/Java/JavadocParser.kt | 12 ++-- .../main/kotlin/Kotlin/DeclarationLinkResolver.kt | 6 +- .../kotlin/Kotlin/DescriptorDocumentationParser.kt | 8 +-- .../src/main/kotlin/Kotlin/DocumentationBuilder.kt | 4 +- .../Kotlin/KotlinAsJavaDocumentationBuilder.kt | 3 +- .../main/kotlin/Kotlin/KotlinLanguageService.kt | 2 +- .../main/kotlin/Languages/JavaLanguageService.kt | 8 +-- core/src/main/kotlin/Model/Content.kt | 8 +-- core/src/main/kotlin/Model/DocumentationNode.kt | 8 +-- .../main/kotlin/Model/DocumentationReference.kt | 6 +- core/src/main/kotlin/Model/PackageDocs.kt | 2 +- core/src/main/kotlin/Model/SourceLinks.kt | 2 +- .../Samples/DefaultSampleProcessingService.kt | 6 +- core/src/main/kotlin/Utilities/DokkaModules.kt | 6 +- core/src/main/kotlin/Utilities/ServiceLocator.kt | 4 +- core/src/main/kotlin/javadoc/docbase.kt | 11 ++-- core/src/test/kotlin/TestAPI.kt | 1 - core/src/test/kotlin/format/HtmlFormatTest.kt | 1 - .../test/kotlin/format/KotlinWebSiteFormatTest.kt | 1 - .../kotlin/format/KotlinWebSiteHtmlFormatTest.kt | 1 - .../KotlinWebSiteRunnableSamplesFormatTest.kt | 4 -- core/src/test/kotlin/format/MarkdownFormatTest.kt | 1 - core/src/test/kotlin/issues/IssuesTest.kt | 1 - core/src/test/kotlin/javadoc/JavadocTest.kt | 5 +- core/src/test/kotlin/model/FunctionTest.kt | 1 - .../dokka/gradle/AbstractDokkaAndroidGradleTest.kt | 2 +- .../dokka/gradle/AbstractDokkaGradleTest.kt | 9 +-- .../dokka/gradle/AndroidLibDependsOnJavaLibTest.kt | 2 - runners/maven-plugin/src/main/kotlin/DokkaMojo.kt | 4 +- 38 files changed, 113 insertions(+), 122 deletions(-) (limited to 'core/src') 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 @@ + + + + + + + + + + + + + + + + + + + + \ 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 @@ \ 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 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 = 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) } 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.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) + node.details(NodeKind.Parameter)).map { renderParameter(it) }.joinTo(this) + (listOf(receiver) + node.details(NodeKind.Parameter)).joinTo(this) { renderParameter(it) } else - node.details(NodeKind.Parameter).map { renderParameter(it) }.joinTo(this) + node.details(NodeKind.Parameter).joinTo(this) { renderParameter(it) } append(")") }.toString() diff --git a/core/src/main/kotlin/Model/Content.kt b/core/src/main/kotlin/Model/Content.kt index 1f5bbc83..ccb5bff3 100644 --- a/core/src/main/kotlin/Model/Content.kt +++ b/core/src/main/kotlin/Model/Content.kt @@ -135,10 +135,10 @@ class ContentSection(val tag: String, val subjectName: String?) : ContentBlock() } object ContentTags { - val Description = "Description" - val SeeAlso = "See Also" - val Return = "Return" - val Exceptions = "Exceptions" + const val Description = "Description" + const val SeeAlso = "See Also" + const val Return = "Return" + const val Exceptions = "Exceptions" } fun content(body: ContentBlock.() -> Unit): ContentBlock { diff --git a/core/src/main/kotlin/Model/DocumentationNode.kt b/core/src/main/kotlin/Model/DocumentationNode.kt index da85cabf..3ff1d127 100644 --- a/core/src/main/kotlin/Model/DocumentationNode.kt +++ b/core/src/main/kotlin/Model/DocumentationNode.kt @@ -130,10 +130,10 @@ open class DocumentationNode(val name: String, fun inheritedCompanionObjectMembers(kind: NodeKind): List = inheritedCompanionObjectMembers.filter { it.kind == kind } fun links(kind: NodeKind): List = links.filter { it.kind == kind } - fun detail(kind: NodeKind): DocumentationNode = details.filter { it.kind == kind }.single() - fun detailOrNull(kind: NodeKind): DocumentationNode? = details.filter { it.kind == kind }.singleOrNull() - fun member(kind: NodeKind): DocumentationNode = members.filter { it.kind == kind }.single() - fun link(kind: NodeKind): DocumentationNode = links.filter { it.kind == kind }.single() + fun detail(kind: NodeKind): DocumentationNode = details.single { it.kind == kind } + fun detailOrNull(kind: NodeKind): DocumentationNode? = details.singleOrNull { it.kind == kind } + fun member(kind: NodeKind): DocumentationNode = members.single { it.kind == kind } + fun link(kind: NodeKind): DocumentationNode = links.single { it.kind == kind } fun references(kind: RefKind): List = references.filter { it.kind == kind } fun allReferences(): Set = references diff --git a/core/src/main/kotlin/Model/DocumentationReference.kt b/core/src/main/kotlin/Model/DocumentationReference.kt index a968f400..87e7ecea 100644 --- a/core/src/main/kotlin/Model/DocumentationReference.kt +++ b/core/src/main/kotlin/Model/DocumentationReference.kt @@ -45,15 +45,15 @@ class NodeReferenceGraph() { } fun link(fromNode: DocumentationNode, toSignature: String, kind: RefKind) { - references.add(PendingDocumentationReference({ -> fromNode}, { -> nodeMap[toSignature]}, kind)) + references.add(PendingDocumentationReference({ fromNode}, { nodeMap[toSignature]}, kind)) } fun link(fromSignature: String, toNode: DocumentationNode, kind: RefKind) { - references.add(PendingDocumentationReference({ -> nodeMap[fromSignature]}, { -> toNode}, kind)) + references.add(PendingDocumentationReference({ nodeMap[fromSignature]}, { toNode}, kind)) } fun link(fromSignature: String, toSignature: String, kind: RefKind) { - references.add(PendingDocumentationReference({ -> nodeMap[fromSignature]}, { -> nodeMap[toSignature]}, kind)) + references.add(PendingDocumentationReference({ nodeMap[fromSignature]}, { nodeMap[toSignature]}, kind)) } fun lookup(signature: String) = nodeMap[signature] diff --git a/core/src/main/kotlin/Model/PackageDocs.kt b/core/src/main/kotlin/Model/PackageDocs.kt index bb8e98d1..7ba4bdad 100644 --- a/core/src/main/kotlin/Model/PackageDocs.kt +++ b/core/src/main/kotlin/Model/PackageDocs.kt @@ -33,7 +33,7 @@ class PackageDocs targetContent = findTargetContent(headingText.trimStart()) } } else { - buildContentTo(it, targetContent, LinkResolver(linkMap, { resolveContentLink(fileName, it, linkResolveContext) })) + buildContentTo(it, targetContent, LinkResolver(linkMap) { resolveContentLink(fileName, it, linkResolveContext) }) } } } else { diff --git a/core/src/main/kotlin/Model/SourceLinks.kt b/core/src/main/kotlin/Model/SourceLinks.kt index 2c75cfda..7575b2b3 100644 --- a/core/src/main/kotlin/Model/SourceLinks.kt +++ b/core/src/main/kotlin/Model/SourceLinks.kt @@ -23,7 +23,7 @@ fun DocumentationNode.appendSourceLink(psi: PsiElement?, sourceLinks: List Binder.lazyBind(): Lazy> inline infix fun > Lazy>.toOptional(kClass: TKClass?) = kClass?.let { value toType it } -inline infix fun > AnnotatedBindingBuilder.toType(kClass: TKClass) = to(kClass.java) +inline infix fun > AnnotatedBindingBuilder.toType(kClass: TKClass): ScopedBindingBuilder = to(kClass.java) diff --git a/core/src/main/kotlin/Utilities/ServiceLocator.kt b/core/src/main/kotlin/Utilities/ServiceLocator.kt index 71bfd21b..6f2ebd0f 100644 --- a/core/src/main/kotlin/Utilities/ServiceLocator.kt +++ b/core/src/main/kotlin/Utilities/ServiceLocator.kt @@ -15,9 +15,7 @@ object ServiceLocator { fun lookup(clazz: Class, category: String, implementationName: String): T { val descriptor = lookupDescriptor(category, implementationName) val loadedClass = javaClass.classLoader.loadClass(descriptor.className) - val constructor = loadedClass.constructors - .filter { it.parameterTypes.isEmpty() } - .firstOrNull() ?: throw ServiceLookupException("Class ${descriptor.className} has no corresponding constructor") + val constructor = loadedClass.constructors.firstOrNull { it.parameterTypes.isEmpty() } ?: throw ServiceLookupException("Class ${descriptor.className} has no corresponding constructor") val implementationRawType: Any = if (constructor.parameterTypes.isEmpty()) constructor.newInstance() else constructor.newInstance(constructor) diff --git a/core/src/main/kotlin/javadoc/docbase.kt b/core/src/main/kotlin/javadoc/docbase.kt index 2a14c6ff..f33b1324 100644 --- a/core/src/main/kotlin/javadoc/docbase.kt +++ b/core/src/main/kotlin/javadoc/docbase.kt @@ -326,8 +326,9 @@ open class ExecutableMemberAdapter(module: ModuleNodeAdapter, node: Documentatio override fun thrownExceptionTypes(): Array = emptyArray() override fun receiverType(): Type? = receiverNode()?.let { receiver -> TypeAdapter(module, receiver) } - override fun flatSignature(): String = node.details(NodeKind.Parameter).map { JavaLanguageService().renderType(it) }.joinToString(", ", "(", ")") - override fun signature(): String = node.details(NodeKind.Parameter).map { JavaLanguageService().renderType(it) }.joinToString(", ", "(", ")") // TODO it should be FQ types + override fun flatSignature(): String = node.details(NodeKind.Parameter).joinToString(", ", "(", ")") { JavaLanguageService().renderType(it) } + override fun signature(): String = + node.details(NodeKind.Parameter).joinToString(", ", "(", ")") { JavaLanguageService().renderType(it) } // TODO it should be FQ types override fun parameters(): Array = ((receiverNode()?.let { receiver -> listOf(ReceiverParameterAdapter(module, receiver, this)) } ?: emptyList()) @@ -469,10 +470,8 @@ open class ClassDocumentationNodeAdapter(module: ModuleNodeAdapter, val classNod } fun DocumentationNode.lookupSuperClasses(module: ModuleNodeAdapter) = - details(NodeKind.Supertype) - .map { it.links.firstOrNull() } - .map { module.allTypes[it?.qualifiedName()] } - .filterNotNull() + details(NodeKind.Supertype) + .map { it.links.firstOrNull() }.mapNotNull { module.allTypes[it?.qualifiedName()] } fun List.collectAllTypesRecursively(): Map { val result = hashMapOf() diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt index aa3eff48..fa108b99 100644 --- a/core/src/test/kotlin/TestAPI.kt +++ b/core/src/test/kotlin/TestAPI.kt @@ -6,7 +6,6 @@ import com.intellij.openapi.util.Disposer import com.intellij.openapi.util.io.FileUtil import com.intellij.rt.execution.junit.FileComparisonFailure import org.jetbrains.dokka.* -import org.jetbrains.dokka.DokkaConfiguration.SourceLinkDefinition import org.jetbrains.dokka.Utilities.DokkaAnalysisModule import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity diff --git a/core/src/test/kotlin/format/HtmlFormatTest.kt b/core/src/test/kotlin/format/HtmlFormatTest.kt index 54c367fd..fd851414 100644 --- a/core/src/test/kotlin/format/HtmlFormatTest.kt +++ b/core/src/test/kotlin/format/HtmlFormatTest.kt @@ -3,7 +3,6 @@ package org.jetbrains.dokka.tests import org.jetbrains.dokka.* import org.jetbrains.kotlin.cli.jvm.config.JavaSourceRoot import org.jetbrains.kotlin.config.KotlinSourceRoot -import org.junit.Before import org.junit.Test import java.io.File diff --git a/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt index b971b54d..53c83de4 100644 --- a/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt +++ b/core/src/test/kotlin/format/KotlinWebSiteFormatTest.kt @@ -1,7 +1,6 @@ package org.jetbrains.dokka.tests import org.jetbrains.dokka.* -import org.junit.Before import org.junit.Ignore import org.junit.Test diff --git a/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt index 49fa6d2f..8643d3e5 100644 --- a/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt +++ b/core/src/test/kotlin/format/KotlinWebSiteHtmlFormatTest.kt @@ -1,7 +1,6 @@ package org.jetbrains.dokka.tests import org.jetbrains.dokka.* -import org.junit.Before import org.junit.Test class KotlinWebSiteHtmlFormatTest: FileGeneratorTestCase() { diff --git a/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt b/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt index 453b1de8..00630e00 100644 --- a/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt +++ b/core/src/test/kotlin/format/KotlinWebSiteRunnableSamplesFormatTest.kt @@ -1,10 +1,6 @@ package org.jetbrains.dokka.tests -import org.jetbrains.dokka.DokkaConsoleLogger -import org.jetbrains.dokka.KotlinLanguageService -import org.jetbrains.dokka.KotlinWebsiteRunnableSamplesFormatService import org.junit.Ignore -import org.junit.Test @Ignore class KotlinWebSiteRunnableSamplesFormatTest { diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt index 9e4c831d..e213315b 100644 --- a/core/src/test/kotlin/format/MarkdownFormatTest.kt +++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt @@ -1,7 +1,6 @@ package org.jetbrains.dokka.tests import org.jetbrains.dokka.* -import org.junit.Before import org.junit.Test class MarkdownFormatTest: FileGeneratorTestCase() { diff --git a/core/src/test/kotlin/issues/IssuesTest.kt b/core/src/test/kotlin/issues/IssuesTest.kt index 625d7e46..e8cb4d9c 100644 --- a/core/src/test/kotlin/issues/IssuesTest.kt +++ b/core/src/test/kotlin/issues/IssuesTest.kt @@ -2,7 +2,6 @@ package issues import org.jetbrains.dokka.DocumentationNode import org.jetbrains.dokka.NodeKind -import org.jetbrains.dokka.tests.toTestString import org.jetbrains.dokka.tests.verifyModel import org.junit.Test import kotlin.test.assertEquals diff --git a/core/src/test/kotlin/javadoc/JavadocTest.kt b/core/src/test/kotlin/javadoc/JavadocTest.kt index 45c45aa4..aaeb7d00 100644 --- a/core/src/test/kotlin/javadoc/JavadocTest.kt +++ b/core/src/test/kotlin/javadoc/JavadocTest.kt @@ -120,8 +120,9 @@ class JavadocTest { .find { it.name() == "some" }!!.parameters().first() .type() assertEquals("kotlin.jvm.functions.Function1", methodParamType.qualifiedTypeName()) - assertEquals("? super A, C", methodParamType.asParameterizedType().typeArguments() - .map(Type::qualifiedTypeName).joinToString()) + assertEquals("? super A, C", + methodParamType.asParameterizedType().typeArguments().joinToString(transform = Type::qualifiedTypeName) + ) } } diff --git a/core/src/test/kotlin/model/FunctionTest.kt b/core/src/test/kotlin/model/FunctionTest.kt index 32910682..8a3f69d8 100644 --- a/core/src/test/kotlin/model/FunctionTest.kt +++ b/core/src/test/kotlin/model/FunctionTest.kt @@ -5,7 +5,6 @@ import org.jetbrains.dokka.NodeKind import org.junit.Assert.assertEquals import org.junit.Assert.assertTrue import org.junit.Test -import kotlin.test.assertNotNull class FunctionTest { @Test fun function() { diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaAndroidGradleTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaAndroidGradleTest.kt index 06753342..d6ed610a 100644 --- a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaAndroidGradleTest.kt +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaAndroidGradleTest.kt @@ -31,7 +31,7 @@ abstract class AbstractDokkaAndroidGradleTest : AbstractDokkaGradleTest() { acceptedLicenses.listFiles().forEach { licenseFile -> val target = sdkLicensesDir.resolve(licenseFile.name) if(!target.exists() || target.readText() != licenseFile.readText()) { - val overwrite = System.getProperty("android.licenses.overwrite", "false").toBoolean() + val overwrite = System.getProperty("android.licenses.overwrite", "false")!!.toBoolean() if (!target.exists() || overwrite) { licenseFile.copyTo(target, true) println("Accepted ${licenseFile.name}, by copying $licenseFile to $target") diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaGradleTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaGradleTest.kt index 255138a9..6bd5786f 100644 --- a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaGradleTest.kt +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AbstractDokkaGradleTest.kt @@ -7,15 +7,16 @@ import org.junit.Rule import org.junit.rules.TemporaryFolder import java.io.File import java.nio.file.Files +import java.nio.file.Path import java.nio.file.Paths -val testDataFolder = Paths.get("testData") +val testDataFolder: Path = Paths.get("testData") -val pluginClasspathData = Paths.get("build", "createClasspathManifest", "dokka-plugin-classpath.txt") -val androidPluginClasspathData = pluginClasspathData.resolveSibling("android-dokka-plugin-classpath.txt") +val pluginClasspathData: Path = Paths.get("build", "createClasspathManifest", "dokka-plugin-classpath.txt") +val androidPluginClasspathData: Path = pluginClasspathData.resolveSibling("android-dokka-plugin-classpath.txt") -val dokkaFatJarPathData = pluginClasspathData.resolveSibling("fatjar.txt") +val dokkaFatJarPathData: Path = pluginClasspathData.resolveSibling("fatjar.txt") val androidLocalProperties = testDataFolder.resolve("android.local.properties").let { if (Files.exists(it)) it else null } diff --git a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidLibDependsOnJavaLibTest.kt b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidLibDependsOnJavaLibTest.kt index 2a4ce712..9bc52273 100644 --- a/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidLibDependsOnJavaLibTest.kt +++ b/runners/gradle-integration-tests/src/test/kotlin/org/jetbrains/dokka/gradle/AndroidLibDependsOnJavaLibTest.kt @@ -2,8 +2,6 @@ package org.jetbrains.dokka.gradle import org.gradle.testkit.runner.TaskOutcome import org.junit.Test -import java.nio.file.Path -import java.nio.file.Paths import kotlin.test.assertEquals class AndroidLibDependsOnJavaLibTest: AbstractDokkaAndroidGradleTest() { diff --git a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt index 09da90c6..0a5d63e0 100644 --- a/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt +++ b/runners/maven-plugin/src/main/kotlin/DokkaMojo.kt @@ -235,11 +235,11 @@ class DokkaJavadocJarMojo : AbstractDokkaMojo() { val javadocJar = File(jarOutputDirectory, jarFileName) val archiver = MavenArchiver() - archiver.setArchiver(jarArchiver) + archiver.archiver = jarArchiver archiver.setOutputFile(javadocJar) archiver.archiver.addDirectory(File(outputDir), arrayOf("**/**"), arrayOf()) - archive.setAddMavenDescriptor(false) + archive.isAddMavenDescriptor = false archiver.createArchive(session, project, archive) return javadocJar -- cgit