aboutsummaryrefslogtreecommitdiff
path: root/subprojects/analysis-java-psi
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-08-31 20:16:01 +0200
committerGitHub <noreply@github.com>2023-08-31 20:16:01 +0200
commit02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33 (patch)
tree66f6d6f089a93b863bf1144666491eca6729ad05 /subprojects/analysis-java-psi
parent6a181a7a2b03ec263788d137610e86937a57d434 (diff)
downloaddokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.gz
dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.bz2
dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.zip
Enable explicit API mode (#3139)
Diffstat (limited to 'subprojects/analysis-java-psi')
-rw-r--r--subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/JavaAnalysisPlugin.kt30
-rw-r--r--subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/JavadocTag.kt54
-rw-r--r--subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocComment.kt6
-rw-r--r--subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentCreator.kt4
-rw-r--r--subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentFactory.kt4
-rw-r--r--subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentFinder.kt4
-rw-r--r--subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocumentationContent.kt6
-rw-r--r--subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/DocCommentParser.kt6
-rw-r--r--subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/JavadocParser.kt2
-rw-r--r--subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/doctag/DocTagParserContext.kt10
-rw-r--r--subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/doctag/InheritDocTagContentProvider.kt6
-rw-r--r--subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/util/PsiUtil.kt10
12 files changed, 73 insertions, 69 deletions
diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/JavaAnalysisPlugin.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/JavaAnalysisPlugin.kt
index cd6359cc..9426adf1 100644
--- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/JavaAnalysisPlugin.kt
+++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/JavaAnalysisPlugin.kt
@@ -26,48 +26,48 @@ import java.io.File
@InternalDokkaApi
-interface ProjectProvider {
- fun getProject(sourceSet: DokkaSourceSet, context: DokkaContext): Project
+public interface ProjectProvider {
+ public fun getProject(sourceSet: DokkaSourceSet, context: DokkaContext): Project
}
@InternalDokkaApi
-interface SourceRootsExtractor {
- fun extract(sourceSet: DokkaSourceSet, context: DokkaContext): List<File>
+public interface SourceRootsExtractor {
+ public fun extract(sourceSet: DokkaSourceSet, context: DokkaContext): List<File>
}
@InternalDokkaApi
-interface BreakingAbstractionKotlinLightMethodChecker {
+public interface BreakingAbstractionKotlinLightMethodChecker {
// TODO [beresnev] not even sure it's needed, but left for compatibility and to preserve behaviour
- fun isLightAnnotation(annotation: PsiAnnotation): Boolean
- fun isLightAnnotationAttribute(attribute: JvmAnnotationAttribute): Boolean
+ public fun isLightAnnotation(annotation: PsiAnnotation): Boolean
+ public fun isLightAnnotationAttribute(attribute: JvmAnnotationAttribute): Boolean
}
@InternalDokkaApi
-class JavaAnalysisPlugin : DokkaPlugin() {
+public class JavaAnalysisPlugin : DokkaPlugin() {
// single
- val projectProvider by extensionPoint<ProjectProvider>()
+ public val projectProvider: ExtensionPoint<ProjectProvider> by extensionPoint()
// single
- val sourceRootsExtractor by extensionPoint<SourceRootsExtractor>()
+ public val sourceRootsExtractor: ExtensionPoint<SourceRootsExtractor> by extensionPoint()
// multiple
- val docCommentCreators by extensionPoint<DocCommentCreator>()
+ public val docCommentCreators: ExtensionPoint<DocCommentCreator> by extensionPoint()
// multiple
- val docCommentParsers by extensionPoint<DocCommentParser>()
+ public val docCommentParsers: ExtensionPoint<DocCommentParser> by extensionPoint()
// none or more
- val inheritDocTagContentProviders by extensionPoint<InheritDocTagContentProvider>()
+ public val inheritDocTagContentProviders: ExtensionPoint<InheritDocTagContentProvider> by extensionPoint()
// TODO [beresnev] figure out a better way depending on what it's used for
- val kotlinLightMethodChecker by extensionPoint<BreakingAbstractionKotlinLightMethodChecker>()
+ public val kotlinLightMethodChecker: ExtensionPoint<BreakingAbstractionKotlinLightMethodChecker> by extensionPoint()
private val docCommentFactory by lazy {
DocCommentFactory(query { docCommentCreators }.reversed())
}
- val docCommentFinder by lazy {
+ public val docCommentFinder: DocCommentFinder by lazy {
DocCommentFinder(logger, docCommentFactory)
}
diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/JavadocTag.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/JavadocTag.kt
index 25aaf582..23aee764 100644
--- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/JavadocTag.kt
+++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/JavadocTag.kt
@@ -8,45 +8,47 @@ import com.intellij.psi.PsiMethod
import org.jetbrains.dokka.InternalDokkaApi
@InternalDokkaApi
-sealed class JavadocTag(val name: String)
-
-object AuthorJavadocTag : JavadocTag("author")
-object DeprecatedJavadocTag : JavadocTag("deprecated")
-object DescriptionJavadocTag : JavadocTag("description")
-object ReturnJavadocTag : JavadocTag("return")
-object SinceJavadocTag : JavadocTag("since")
-
-class ParamJavadocTag(
- val method: PsiMethod,
- val paramName: String,
- val paramIndex: Int
+public sealed class JavadocTag(
+ public val name: String
+)
+
+public object AuthorJavadocTag : JavadocTag("author")
+public object DeprecatedJavadocTag : JavadocTag("deprecated")
+public object DescriptionJavadocTag : JavadocTag("description")
+public object ReturnJavadocTag : JavadocTag("return")
+public object SinceJavadocTag : JavadocTag("since")
+
+public class ParamJavadocTag(
+ public val method: PsiMethod,
+ public val paramName: String,
+ public val paramIndex: Int
) : JavadocTag(name) {
- companion object {
- const val name: String = "param"
+ public companion object {
+ public const val name: String = "param"
}
}
-class SeeJavadocTag(
- val qualifiedReference: String
+public class SeeJavadocTag(
+ public val qualifiedReference: String
) : JavadocTag(name) {
- companion object {
- const val name: String = "see"
+ public companion object {
+ public const val name: String = "see"
}
}
-sealed class ThrowingExceptionJavadocTag(
+public sealed class ThrowingExceptionJavadocTag(
name: String,
- val exceptionQualifiedName: String?
+ public val exceptionQualifiedName: String?
) : JavadocTag(name)
-class ThrowsJavadocTag(exceptionQualifiedName: String?) : ThrowingExceptionJavadocTag(name, exceptionQualifiedName) {
- companion object {
- const val name: String = "throws"
+public class ThrowsJavadocTag(exceptionQualifiedName: String?) : ThrowingExceptionJavadocTag(name, exceptionQualifiedName) {
+ public companion object {
+ public const val name: String = "throws"
}
}
-class ExceptionJavadocTag(exceptionQualifiedName: String?) : ThrowingExceptionJavadocTag(name, exceptionQualifiedName) {
- companion object {
- const val name: String = "exception"
+public class ExceptionJavadocTag(exceptionQualifiedName: String?) : ThrowingExceptionJavadocTag(name, exceptionQualifiedName) {
+ public companion object {
+ public const val name: String = "exception"
}
}
diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocComment.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocComment.kt
index b74d3ff2..be5f7eaa 100644
--- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocComment.kt
+++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocComment.kt
@@ -11,8 +11,8 @@ import org.jetbrains.dokka.analysis.java.JavadocTag
* MUST override equals and hashcode
*/
@InternalDokkaApi
-interface DocComment {
- fun hasTag(tag: JavadocTag): Boolean
+public interface DocComment {
+ public fun hasTag(tag: JavadocTag): Boolean
- fun resolveTag(tag: JavadocTag): List<DocumentationContent>
+ public fun resolveTag(tag: JavadocTag): List<DocumentationContent>
}
diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentCreator.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentCreator.kt
index 7c56ddb4..2e22c77c 100644
--- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentCreator.kt
+++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentCreator.kt
@@ -8,6 +8,6 @@ import com.intellij.psi.PsiNamedElement
import org.jetbrains.dokka.InternalDokkaApi
@InternalDokkaApi
-interface DocCommentCreator {
- fun create(element: PsiNamedElement): DocComment?
+public interface DocCommentCreator {
+ public fun create(element: PsiNamedElement): DocComment?
}
diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentFactory.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentFactory.kt
index 52c0d18b..4647d4d9 100644
--- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentFactory.kt
+++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentFactory.kt
@@ -8,10 +8,10 @@ import com.intellij.psi.PsiNamedElement
import org.jetbrains.dokka.InternalDokkaApi
@InternalDokkaApi
-class DocCommentFactory(
+public class DocCommentFactory(
private val docCommentCreators: List<DocCommentCreator>
) {
- fun fromElement(element: PsiNamedElement): DocComment? {
+ public fun fromElement(element: PsiNamedElement): DocComment? {
docCommentCreators.forEach { creator ->
val comment = creator.create(element)
if (comment != null) {
diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentFinder.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentFinder.kt
index 8b88f790..18463e0e 100644
--- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentFinder.kt
+++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocCommentFinder.kt
@@ -14,11 +14,11 @@ import org.jetbrains.dokka.links.DRI
import org.jetbrains.dokka.utilities.DokkaLogger
@InternalDokkaApi
-class DocCommentFinder(
+public class DocCommentFinder(
private val logger: DokkaLogger,
private val docCommentFactory: DocCommentFactory,
) {
- fun findClosestToElement(element: PsiNamedElement): DocComment? {
+ public fun findClosestToElement(element: PsiNamedElement): DocComment? {
val docComment = docCommentFactory.fromElement(element)
if (docComment != null) {
return docComment
diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocumentationContent.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocumentationContent.kt
index 18548951..64e9ceb8 100644
--- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocumentationContent.kt
+++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/doccomment/DocumentationContent.kt
@@ -8,8 +8,8 @@ import org.jetbrains.dokka.InternalDokkaApi
import org.jetbrains.dokka.analysis.java.JavadocTag
@InternalDokkaApi
-interface DocumentationContent {
- val tag: JavadocTag
+public interface DocumentationContent {
+ public val tag: JavadocTag
- fun resolveSiblings(): List<DocumentationContent>
+ public fun resolveSiblings(): List<DocumentationContent>
}
diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/DocCommentParser.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/DocCommentParser.kt
index d7863e7e..4a381e80 100644
--- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/DocCommentParser.kt
+++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/DocCommentParser.kt
@@ -10,7 +10,7 @@ import org.jetbrains.dokka.analysis.java.doccomment.DocComment
import org.jetbrains.dokka.model.doc.DocumentationNode
@InternalDokkaApi
-interface DocCommentParser {
- fun canParse(docComment: DocComment): Boolean
- fun parse(docComment: DocComment, context: PsiNamedElement): DocumentationNode
+public interface DocCommentParser {
+ public fun canParse(docComment: DocComment): Boolean
+ public fun parse(docComment: DocComment, context: PsiNamedElement): DocumentationNode
}
diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/JavadocParser.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/JavadocParser.kt
index ec644692..140e64c9 100644
--- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/JavadocParser.kt
+++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/JavadocParser.kt
@@ -14,7 +14,7 @@ internal fun interface JavaDocumentationParser {
}
@InternalDokkaApi
-class JavadocParser(
+public class JavadocParser(
private val docCommentParsers: List<DocCommentParser>,
private val docCommentFinder: DocCommentFinder
) : JavaDocumentationParser {
diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/doctag/DocTagParserContext.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/doctag/DocTagParserContext.kt
index cd9e5321..e8df804b 100644
--- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/doctag/DocTagParserContext.kt
+++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/doctag/DocTagParserContext.kt
@@ -10,7 +10,7 @@ import org.jetbrains.dokka.model.doc.DocumentationNode
import java.util.*
@InternalDokkaApi
-class DocTagParserContext {
+public class DocTagParserContext {
/**
* exists for resolving `@link element` links, where the referenced
* PSI element is mapped as DRI
@@ -30,7 +30,7 @@ class DocTagParserContext {
/**
* @return key of the stored DRI
*/
- fun store(dri: DRI): String {
+ public fun store(dri: DRI): String {
val id = dri.toString()
driMap[id] = dri
return id
@@ -39,13 +39,13 @@ class DocTagParserContext {
/**
* @return key of the stored documentation node
*/
- fun store(documentationNode: DocumentationNode): String {
+ public fun store(documentationNode: DocumentationNode): String {
val id = UUID.randomUUID().toString()
inheritDocSections[id] = documentationNode
return id
}
- fun getDri(id: String): DRI? = driMap[id]
+ public fun getDri(id: String): DRI? = driMap[id]
- fun getDocumentationNode(id: String): DocumentationNode? = inheritDocSections[id]
+ public fun getDocumentationNode(id: String): DocumentationNode? = inheritDocSections[id]
}
diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/doctag/InheritDocTagContentProvider.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/doctag/InheritDocTagContentProvider.kt
index 33e99ed9..a09f85c4 100644
--- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/doctag/InheritDocTagContentProvider.kt
+++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/parsers/doctag/InheritDocTagContentProvider.kt
@@ -8,7 +8,7 @@ import org.jetbrains.dokka.InternalDokkaApi
import org.jetbrains.dokka.analysis.java.doccomment.DocumentationContent
@InternalDokkaApi
-interface InheritDocTagContentProvider {
- fun canConvert(content: DocumentationContent): Boolean
- fun convertToHtml(content: DocumentationContent, docTagParserContext: DocTagParserContext): String
+public interface InheritDocTagContentProvider {
+ public fun canConvert(content: DocumentationContent): Boolean
+ public fun convertToHtml(content: DocumentationContent, docTagParserContext: DocTagParserContext): String
}
diff --git a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/util/PsiUtil.kt b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/util/PsiUtil.kt
index 38dbe30b..162f940e 100644
--- a/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/util/PsiUtil.kt
+++ b/subprojects/analysis-java-psi/src/main/kotlin/org/jetbrains/dokka/analysis/java/util/PsiUtil.kt
@@ -17,7 +17,7 @@ internal val PsiElement.parentsWithSelf: Sequence<PsiElement>
get() = generateSequence(this) { if (it is PsiFile) null else it.parent }
@InternalDokkaApi
-fun DRI.Companion.from(psi: PsiElement) = psi.parentsWithSelf.run {
+public fun DRI.Companion.from(psi: PsiElement): DRI = psi.parentsWithSelf.run {
val psiMethod = firstIsInstanceOrNull<PsiMethod>()
val psiField = firstIsInstanceOrNull<PsiField>()
val classes = filterIsInstance<PsiClass>().filterNot { it is PsiTypeParameter }
@@ -92,8 +92,10 @@ internal fun PsiElement.getNextSiblingIgnoringWhitespace(withItself: Boolean = f
}
@InternalDokkaApi
-class PsiDocumentableSource(val psi: PsiNamedElement) : DocumentableSource {
- override val path = psi.containingFile.virtualFile.path
+public class PsiDocumentableSource(
+ public val psi: PsiNamedElement
+) : DocumentableSource {
+ override val path: String = psi.containingFile.virtualFile.path
override fun computeLineNumber(): Int? {
val range = psi.getChildOfType<PsiIdentifier>()?.textRange ?: psi.textRange
@@ -103,7 +105,7 @@ class PsiDocumentableSource(val psi: PsiNamedElement) : DocumentableSource {
}
}
-inline fun <reified T : PsiElement> PsiElement.getChildOfType(): T? {
+public inline fun <reified T : PsiElement> PsiElement.getChildOfType(): T? {
return PsiTreeUtil.getChildOfType(this, T::class.java)
}