aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Formats/FormatService.kt2
-rw-r--r--src/Formats/HtmlTemplateService.kt2
-rw-r--r--src/Formats/KotlinWebsiteFormatService.kt2
-rw-r--r--src/Formats/OutlineService.kt2
-rw-r--r--src/Formats/StructuredFormatService.kt4
-rw-r--r--src/Java/JavaDocumentationBuilder.kt4
-rw-r--r--src/Kotlin/ContentBuilder.kt4
-rw-r--r--src/Kotlin/DocumentationBuilder.kt4
-rw-r--r--src/Kotlin/KotlinLanguageService.kt2
-rw-r--r--src/Languages/LanguageService.kt4
-rw-r--r--src/Locations/LocationService.kt8
-rw-r--r--src/Model/Content.kt8
-rw-r--r--src/Model/DocumentationNode.kt56
-rw-r--r--src/Model/DocumentationReference.kt18
-rw-r--r--src/main.kt4
15 files changed, 62 insertions, 62 deletions
diff --git a/src/Formats/FormatService.kt b/src/Formats/FormatService.kt
index cc190346..93470a4c 100644
--- a/src/Formats/FormatService.kt
+++ b/src/Formats/FormatService.kt
@@ -8,7 +8,7 @@ package org.jetbrains.dokka
* * [MarkdownFormatService] – outputs documentation in Markdown format
* * [TextFormatService] – outputs documentation in Text format
*/
-public trait FormatService {
+public interface FormatService {
/** Returns extension for output files */
val extension: String
diff --git a/src/Formats/HtmlTemplateService.kt b/src/Formats/HtmlTemplateService.kt
index 246bd11e..b9900757 100644
--- a/src/Formats/HtmlTemplateService.kt
+++ b/src/Formats/HtmlTemplateService.kt
@@ -1,6 +1,6 @@
package org.jetbrains.dokka
-public trait HtmlTemplateService {
+public interface HtmlTemplateService {
fun appendHeader(to: StringBuilder, title: String?)
fun appendFooter(to: StringBuilder)
diff --git a/src/Formats/KotlinWebsiteFormatService.kt b/src/Formats/KotlinWebsiteFormatService.kt
index 3b95a915..21fc9dae 100644
--- a/src/Formats/KotlinWebsiteFormatService.kt
+++ b/src/Formats/KotlinWebsiteFormatService.kt
@@ -71,7 +71,7 @@ public class KotlinWebsiteFormatService(locationService: LocationService,
super.appendBlockCode(to, line, language)
} else {
to.append("<pre markdown=\"1\">")
- to.append(line.trimLeading())
+ to.append(line.trimStart())
to.append("</pre>")
}
}
diff --git a/src/Formats/OutlineService.kt b/src/Formats/OutlineService.kt
index 9f25da50..6c7e882e 100644
--- a/src/Formats/OutlineService.kt
+++ b/src/Formats/OutlineService.kt
@@ -5,7 +5,7 @@ import java.io.File
/**
* Service for building the outline of the package contents.
*/
-public trait OutlineFormatService {
+public interface OutlineFormatService {
fun getOutlineFileName(location: Location): File
public fun appendOutlineHeader(location: Location, node: DocumentationNode, to: StringBuilder)
diff --git a/src/Formats/StructuredFormatService.kt b/src/Formats/StructuredFormatService.kt
index 0ee3c888..a90c60b1 100644
--- a/src/Formats/StructuredFormatService.kt
+++ b/src/Formats/StructuredFormatService.kt
@@ -6,7 +6,7 @@ import org.jetbrains.dokka.LanguageService.RenderMode
public data class FormatLink(val text: String, val href: String)
enum class ListKind {
- Ordered
+ Ordered,
Unordered
}
@@ -183,7 +183,7 @@ public abstract class StructuredFormatService(locationService: LocationService,
val deprecationValue = deprecationParameter?.details(DocumentationNode.Kind.Value)?.firstOrNull()
if (deprecationValue != null) {
to.append(formatStrong("Deprecated:")).append(" ")
- appendLine(to, formatText(deprecationValue.name.trim("\"")))
+ appendLine(to, formatText(deprecationValue.name.removeSurrounding("\"")))
appendLine(to)
} else if (deprecation?.content != Content.Empty) {
to.append(formatStrong("Deprecated:")).append(" ")
diff --git a/src/Java/JavaDocumentationBuilder.kt b/src/Java/JavaDocumentationBuilder.kt
index d57210ae..466ba304 100644
--- a/src/Java/JavaDocumentationBuilder.kt
+++ b/src/Java/JavaDocumentationBuilder.kt
@@ -62,7 +62,7 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions,
htmlBuilder.append(it.getText())
}
}
- val doc = Jsoup.parse(htmlBuilder.toString().trimLeading())
+ val doc = Jsoup.parse(htmlBuilder.toString().trimStart())
doc.body().childNodes().forEach {
convertHtmlNode(it)
}
@@ -142,7 +142,7 @@ public class JavaDocumentationBuilder(private val options: DocumentationOptions,
"code", "literal" -> {
val text = StringBuilder()
tag.getDataElements().forEach { text.append(it.getText()) }
- val escaped = text.toString().trimLeading().htmlEscape()
+ val escaped = text.toString().trimStart().htmlEscape()
if (tag.getName() == "code") "<code>$escaped</code>" else escaped
}
else -> tag.getText()
diff --git a/src/Kotlin/ContentBuilder.kt b/src/Kotlin/ContentBuilder.kt
index 3dd5c00e..01feef34 100644
--- a/src/Kotlin/ContentBuilder.kt
+++ b/src/Kotlin/ContentBuilder.kt
@@ -138,14 +138,14 @@ fun DocumentationBuilder.functionBody(descriptor: DeclarationDescriptor, functio
is JetDeclarationWithBody -> ContentBlockCode().let() {
val bodyExpression = psiElement.getBodyExpression()
when (bodyExpression) {
- is JetBlockExpression -> bodyExpression.getText().trim("{", "}")
+ is JetBlockExpression -> bodyExpression.getText().removeSurrounding("{", "}")
else -> bodyExpression.getText()
}
}
else -> psiElement.getText()
}
- val lines = text.trimTrailing().split("\n").filterNot { it.length() == 0 }
+ val lines = text.trimEnd().split("\n".toRegex()).toTypedArray().filterNot { it.length() == 0 }
val indent = lines.map { it.takeWhile { it.isWhitespace() }.count() }.min() ?: 0
val finalText = lines.map { it.drop(indent) }.join("\n")
return ContentBlockCode("kotlin").let() { it.append(ContentText(finalText)); it }
diff --git a/src/Kotlin/DocumentationBuilder.kt b/src/Kotlin/DocumentationBuilder.kt
index b1a5903e..4af53d88 100644
--- a/src/Kotlin/DocumentationBuilder.kt
+++ b/src/Kotlin/DocumentationBuilder.kt
@@ -96,7 +96,7 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade,
}
val name = descriptor.getName().asString()
if (name == "equals" || name == "hashCode" || name == "toString") {
- var deepestDescriptor = descriptor: CallableMemberDescriptor
+ var deepestDescriptor: CallableMemberDescriptor = descriptor
while (!deepestDescriptor.getOverriddenDescriptors().isEmpty()) {
deepestDescriptor = deepestDescriptor.getOverriddenDescriptors().first()
}
@@ -203,7 +203,7 @@ class DocumentationBuilder(val resolutionFacade: ResolutionFacade,
return symbol
}
- fun KDocSection.getTags(): Array<KDocTag> = PsiTreeUtil.getChildrenOfType(this, javaClass<KDocTag>()) ?: array()
+ fun KDocSection.getTags(): Array<KDocTag> = PsiTreeUtil.getChildrenOfType(this, javaClass<KDocTag>()) ?: arrayOf()
private fun MutableContent.addTagToSeeAlso(descriptor: DeclarationDescriptor, seeTag: KDocTag) {
val subjectName = seeTag.getSubjectName()
diff --git a/src/Kotlin/KotlinLanguageService.kt b/src/Kotlin/KotlinLanguageService.kt
index 8809a630..75675c6f 100644
--- a/src/Kotlin/KotlinLanguageService.kt
+++ b/src/Kotlin/KotlinLanguageService.kt
@@ -56,7 +56,7 @@ class KotlinLanguageService : LanguageService {
renderItem(nodes.first())
nodes.drop(1).forEach {
if (noWrap) {
- symbol(separator.trimTrailing(" "))
+ symbol(separator.removeSuffix(" "))
nbsp()
} else {
symbol(separator)
diff --git a/src/Languages/LanguageService.kt b/src/Languages/LanguageService.kt
index 3508b48d..c587335a 100644
--- a/src/Languages/LanguageService.kt
+++ b/src/Languages/LanguageService.kt
@@ -3,10 +3,10 @@ package org.jetbrains.dokka
/**
* Provides facility for rendering [DocumentationNode] as a language-dependent declaration
*/
-trait LanguageService {
+interface LanguageService {
enum class RenderMode {
/** Brief signature (used in a list of all members of the class). */
- SUMMARY
+ SUMMARY,
/** Full signature (used in the page describing the member itself */
FULL
}
diff --git a/src/Locations/LocationService.kt b/src/Locations/LocationService.kt
index 2c93ba8f..7d0b8b56 100644
--- a/src/Locations/LocationService.kt
+++ b/src/Locations/LocationService.kt
@@ -2,7 +2,7 @@ package org.jetbrains.dokka
import java.io.File
-public trait Location {
+public interface Location {
val path: String get
fun relativePathTo(other: Location, anchor: String? = null): String
}
@@ -41,7 +41,7 @@ public data class FileLocation(val file: File): Location {
* * [SingleFolderLocationService] – all documentation is generated into single folder using fully qualified names
* for file names.
*/
-public trait LocationService {
+public interface LocationService {
fun withExtension(newExtension: String) = this
fun location(node: DocumentationNode): Location = location(node.path.map { it.name }, node.members.any())
@@ -54,7 +54,7 @@ public trait LocationService {
}
-public trait FileLocationService: LocationService {
+public interface FileLocationService: LocationService {
override fun location(node: DocumentationNode): FileLocation = location(node.path.map { it.name }, node.members.any())
override fun location(qualifiedName: List<String>, hasMembers: Boolean): FileLocation
}
@@ -62,7 +62,7 @@ public trait FileLocationService: LocationService {
public fun identifierToFilename(path: String): String {
val escaped = path.replace('<', '-').replace('>', '-')
- val lowercase = escaped.replaceAll("[A-Z]") { matchResult -> "-" + matchResult.group().toLowerCase() }
+ val lowercase = escaped.replace("[A-Z]".toRegex()) { matchResult -> "-" + matchResult.value.toLowerCase() }
return if (lowercase == "index") "--index--" else lowercase
}
diff --git a/src/Model/Content.kt b/src/Model/Content.kt
index 30ec1fda..b442cd73 100644
--- a/src/Model/Content.kt
+++ b/src/Model/Content.kt
@@ -27,9 +27,9 @@ public open class ContentBlock() : ContentNode() {
}
enum class IdentifierKind {
- TypeName
- ParameterName
- AnnotationName
+ TypeName,
+ ParameterName,
+ AnnotationName,
Other
}
@@ -126,7 +126,7 @@ public open class Content(): ContentBlock() {
public open val description: ContentNode get() = ContentEmpty
fun findSectionByTag(tag: String): ContentSection? =
- sections.firstOrNull { tag.equalsIgnoreCase(it.tag) }
+ sections.firstOrNull { tag.equals(it.tag, ignoreCase = true) }
companion object {
val Empty = Content()
diff --git a/src/Model/DocumentationNode.kt b/src/Model/DocumentationNode.kt
index 6800abef..7f862183 100644
--- a/src/Model/DocumentationNode.kt
+++ b/src/Model/DocumentationNode.kt
@@ -64,43 +64,43 @@ public open class DocumentationNode(val name: String,
}
public enum class Kind {
- Unknown
+ Unknown,
- Package
- Class
- Interface
- Enum
- AnnotationClass
- EnumItem
- Object
+ Package,
+ Class,
+ Interface,
+ Enum,
+ AnnotationClass,
+ EnumItem,
+ Object,
- Constructor
- Function
- Property
+ Constructor,
+ Function,
+ Property,
- CompanionObjectProperty
- CompanionObjectFunction
+ CompanionObjectProperty,
+ CompanionObjectFunction,
- Parameter
- Receiver
- TypeParameter
- Type
- Supertype
- UpperBound
- LowerBound
- Exception
+ Parameter,
+ Receiver,
+ TypeParameter,
+ Type,
+ Supertype,
+ UpperBound,
+ LowerBound,
+ Exception,
- Modifier
- NullabilityModifier
+ Modifier,
+ NullabilityModifier,
- Module
+ Module,
- ExternalClass
- Annotation
+ ExternalClass,
+ Annotation,
- Value
+ Value,
- SourceUrl
+ SourceUrl,
/**
* A note which is rendered once on a page documenting a group of overloaded functions.
diff --git a/src/Model/DocumentationReference.kt b/src/Model/DocumentationReference.kt
index b563b058..a61ac65f 100644
--- a/src/Model/DocumentationReference.kt
+++ b/src/Model/DocumentationReference.kt
@@ -2,15 +2,15 @@ package org.jetbrains.dokka
public data class DocumentationReference(val from: DocumentationNode, val to: DocumentationNode, val kind: DocumentationReference.Kind) {
public enum class Kind {
- Owner
- Member
- Detail
- Link
- Extension
- Inheritor
- Override
- Annotation
- Deprecation
+ Owner,
+ Member,
+ Detail,
+ Link,
+ Extension,
+ Inheritor,
+ Override,
+ Annotation,
+ Deprecation,
TopLevelPage
}
}
diff --git a/src/main.kt b/src/main.kt
index 4e2d2b11..4a0c22f8 100644
--- a/src/main.kt
+++ b/src/main.kt
@@ -96,7 +96,7 @@ public fun main(args: Array<String>) {
DokkaConsoleLogger.report()
}
-trait DokkaLogger {
+interface DokkaLogger {
fun info(message: String)
fun warn(message: String)
fun error(message: String)
@@ -254,7 +254,7 @@ fun KotlinCoreEnvironment.getJavaSourceFiles(): List<PsiJavaFile> {
val result = arrayListOf<PsiJavaFile>()
val localFileSystem = VirtualFileManager.getInstance().getFileSystem("file")
sourceRoots.forEach { sourceRoot ->
- sourceRoot.getAbsoluteFile().recurse {
+ sourceRoot.getAbsoluteFile().walkTopDown().forEach {
val vFile = localFileSystem.findFileByPath(it.path)
if (vFile != null) {
val psiFile = PsiManager.getInstance(project).findFile(vFile)