diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-01-22 11:40:47 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-01-28 22:05:38 +0100 |
commit | c3b911f286186a790be607e9b803e3ed63c77289 (patch) | |
tree | 0ede20415d8e03cbd0fbcf7896be7a39caaa3bcc /core/src | |
parent | 172c7ab00771e3a447ea03c3a81d589eb932c3fb (diff) | |
download | dokka-c3b911f286186a790be607e9b803e3ed63c77289.tar.gz dokka-c3b911f286186a790be607e9b803e3ed63c77289.tar.bz2 dokka-c3b911f286186a790be607e9b803e3ed63c77289.zip |
Patch Java analysis
Diffstat (limited to 'core/src')
5 files changed, 25 insertions, 8 deletions
diff --git a/core/src/main/kotlin/DokkaGenerator.kt b/core/src/main/kotlin/DokkaGenerator.kt index 350ee5df..95f9e647 100644 --- a/core/src/main/kotlin/DokkaGenerator.kt +++ b/core/src/main/kotlin/DokkaGenerator.kt @@ -147,7 +147,7 @@ class DokkaGenerator( }.flatten() return context.single(CoreExtensions.psiToDocumentationTranslator) - .invoke(psiFiles, platformData, context) + .invoke(platformData.name, psiFiles, platformData, context) } diff --git a/core/src/main/kotlin/pages/PageContentBuilder.kt b/core/src/main/kotlin/pages/PageContentBuilder.kt index 25ddc2f1..d56a6d70 100644 --- a/core/src/main/kotlin/pages/PageContentBuilder.kt +++ b/core/src/main/kotlin/pages/PageContentBuilder.kt @@ -166,10 +166,13 @@ class DefaultPageContentBuilder( private fun PageContentBuilder.type(t: TypeWrapper) { if (t.constructorNamePathSegments.isNotEmpty() && t.dri != null) link(t.constructorNamePathSegments.last(), t.dri!!) + else if (t.constructorNamePathSegments.isNotEmpty() && t.dri == null) + text(t.toString()) else (this as? DefaultPageContentBuilder)?.let { logger.error("type $t cannot be resolved") - text(t.toString()) + text("???") } + list(t.arguments, prefix = "<", suffix = ">") { type(it) } diff --git a/core/src/main/kotlin/renderers/HtmlRenderer.kt b/core/src/main/kotlin/renderers/HtmlRenderer.kt index 68d6d276..8742f202 100644 --- a/core/src/main/kotlin/renderers/HtmlRenderer.kt +++ b/core/src/main/kotlin/renderers/HtmlRenderer.kt @@ -22,17 +22,19 @@ open class HtmlRenderer( protected open fun OL.buildListItems(items: List<ContentNode>, pageContext: PageNode) { items.forEach { - if (it is ContentText) + if (it is ContentList) + buildList(it, pageContext) + else li { it.build(this, pageContext) } - else buildList(it as ContentList, pageContext) } } protected open fun UL.buildListItems(items: List<ContentNode>, pageContext: PageNode) { items.forEach { - if (it is ContentText) + if (it is ContentList) + buildList(it, pageContext) + else li { it.build(this, pageContext) } - else buildList(it as ContentList, pageContext) } } @@ -109,7 +111,7 @@ open class HtmlRenderer( override fun FlowContent.buildCode(code: List<ContentNode>, language: String, pageContext: PageNode) { buildNewLine() code.forEach { - + (it as ContentText).text + + ((it as? ContentText)?.text ?: run { context.logger.error("Cannot cast $it as ContentText!"); ""} ) buildNewLine() } } diff --git a/core/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt b/core/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt index d3ad4526..d8595ad3 100644 --- a/core/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt +++ b/core/src/main/kotlin/transformers/psi/DefaultPsiToDocumentationTranslator.kt @@ -13,12 +13,13 @@ import org.jetbrains.dokka.utilities.DokkaLogger object DefaultPsiToDocumentationTranslator : PsiToDocumentationTranslator { override fun invoke( + moduleName: String, psiFiles: List<PsiJavaFile>, platformData: PlatformData, context: DokkaContext ): Module { val docParser = DokkaPsiParser(platformData, context.logger) - return Module( "JavaModule", + return Module(moduleName, psiFiles.map { psiFile -> val dri = DRI(packageName = psiFile.packageName) Package( @@ -145,6 +146,16 @@ class JavaTypeWrapper( if (it is PsiClassReferenceType) JavaTypeWrapper(it) else null } dri = fromPsi(type) + } else if (type is PsiEllipsisType) { + constructorFqName = type.canonicalText + constructorNamePathSegments = listOf(type.canonicalText) // TODO + arguments = emptyList() + dri = DRI("java.lang", "Object") // TODO + } else if (type is PsiArrayType) { + constructorFqName = type.canonicalText + constructorNamePathSegments = listOf(type.canonicalText) + arguments = emptyList() + dri = (type as? PsiClassReferenceType)?.let { fromPsi(it) } // TODO } else { type as PsiPrimitiveType constructorFqName = type.name diff --git a/core/src/main/kotlin/transformers/psi/PsiToDocumentationTranslator.kt b/core/src/main/kotlin/transformers/psi/PsiToDocumentationTranslator.kt index 5a1209b1..41290ef8 100644 --- a/core/src/main/kotlin/transformers/psi/PsiToDocumentationTranslator.kt +++ b/core/src/main/kotlin/transformers/psi/PsiToDocumentationTranslator.kt @@ -7,6 +7,7 @@ import org.jetbrains.dokka.plugability.DokkaContext interface PsiToDocumentationTranslator { fun invoke( + moduleName: String, psiFiles: List<PsiJavaFile>, platformData: PlatformData, context: DokkaContext |