aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Aman <maman@virtuslab.com>2020-07-22 13:27:31 +0200
committerKamil Doległo <9080183+kamildoleglo@users.noreply.github.com>2020-07-22 18:26:32 +0200
commit189bc1e2a9110a945afa8c36f2ffa0c9ef4c4d56 (patch)
tree3b8298639a51ae252590b7fb51b26a13ba88e7c0
parent12526287c6f87ac57883a23c9924bfe0f4e71286 (diff)
downloaddokka-189bc1e2a9110a945afa8c36f2ffa0c9ef4c4d56.tar.gz
dokka-189bc1e2a9110a945afa8c36f2ffa0c9ef4c4d56.tar.bz2
dokka-189bc1e2a9110a945afa8c36f2ffa0c9ef4c4d56.zip
Rename constructors to a classname
-rw-r--r--plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt2
-rw-r--r--plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt2
-rw-r--r--plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt8
-rw-r--r--plugins/base/src/test/kotlin/model/ClassesTest.kt2
-rw-r--r--plugins/base/src/test/kotlin/model/JavaTest.kt1
-rw-r--r--plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaPluginTest.kt2
6 files changed, 9 insertions, 8 deletions
diff --git a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
index ffceaaa7..526db8e7 100644
--- a/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/descriptors/DefaultDescriptorToDocumentableTranslator.kt
@@ -375,7 +375,7 @@ private class DokkaDescriptorVisitor(
return DFunction(
dri = dri,
- name = "<init>",
+ name = descriptor.constructedClass.name.toString(),
isConstructor = true,
receiver = descriptor.extensionReceiverParameter?.let {
visitReceiverParameterDescriptor(it, DRIWithPlatformInfo(dri, actual))
diff --git a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
index 6f980383..df5d4ee1 100644
--- a/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
+++ b/plugins/base/src/main/kotlin/translators/psi/DefaultPsiToDocumentableTranslator.kt
@@ -277,7 +277,7 @@ class DefaultPsiToDocumentableTranslator(
val docs = javadocParser.parseDocumentation(psi)
return DFunction(
dri,
- if (isConstructor) "<init>" else psi.name,
+ psi.name,
isConstructor,
psi.parameterList.parameters.map { psiParameter ->
DParameter(
diff --git a/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt b/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt
index 7de48664..90a38055 100644
--- a/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt
+++ b/plugins/base/src/test/kotlin/content/signatures/SkippingParenthesisForConstructorsTest.kt
@@ -174,13 +174,13 @@ class ConstructorsSignaturesTest : AbstractCoreTest() {
header { +"Constructors" }
table {
group {
- link { +"<init>" }
+ link { +"SomeClass" }
functionSignature(
annotations = emptyMap(),
visibility = "",
modifier = "",
keywords = emptySet(),
- name = "<init>"
+ name = "SomeClass"
)
}
}
@@ -226,7 +226,7 @@ class ConstructorsSignaturesTest : AbstractCoreTest() {
header { +"Constructors" }
table {
group {
- link { +"<init>" }
+ link { +"SomeClass" }
platformHinted {
group {
group {
@@ -235,7 +235,7 @@ class ConstructorsSignaturesTest : AbstractCoreTest() {
}
group {
+"fun"
- link { +"<init>" }
+ link { +"SomeClass" }
+"(a:"
group {
link { +"String" }
diff --git a/plugins/base/src/test/kotlin/model/ClassesTest.kt b/plugins/base/src/test/kotlin/model/ClassesTest.kt
index 5dc8812e..1bf55235 100644
--- a/plugins/base/src/test/kotlin/model/ClassesTest.kt
+++ b/plugins/base/src/test/kotlin/model/ClassesTest.kt
@@ -332,7 +332,7 @@ class ClassesTest : AbstractModelTest("/src/main/kotlin/classes/Test.kt", "class
name equals "C"
constructors counts 2
- constructors.map { it.name } allEquals "<init>"
+ constructors.map { it.name } allEquals "C"
with(constructors.find { it.parameters.isNullOrEmpty() } notNull "C()") {
parameters counts 0
diff --git a/plugins/base/src/test/kotlin/model/JavaTest.kt b/plugins/base/src/test/kotlin/model/JavaTest.kt
index 1f042304..237131d3 100644
--- a/plugins/base/src/test/kotlin/model/JavaTest.kt
+++ b/plugins/base/src/test/kotlin/model/JavaTest.kt
@@ -161,6 +161,7 @@ class JavaTest : AbstractModelTest("/src/main/kotlin/java/Test.java", "java") {
name equals "Test"
constructors counts 2
+ constructors.forEach { it.name equals "Test" }
constructors.find { it.parameters.isNullOrEmpty() }.assertNotNull("Test()")
with(constructors.find { it.parameters.isNotEmpty() }.assertNotNull("Test(String)")) {
diff --git a/plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaPluginTest.kt b/plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaPluginTest.kt
index af66a48e..3dbe5888 100644
--- a/plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaPluginTest.kt
+++ b/plugins/kotlin-as-java/src/test/kotlin/KotlinAsJavaPluginTest.kt
@@ -81,7 +81,7 @@ class KotlinAsJavaPluginTest : AbstractCoreTest() {
content.mainContents.first().cast<ContentGroup>().children
.filterIsInstance<ContentTable>()
.filter { it.children.isNotEmpty() }
- }.filterNot { it.toString().contains("<init>") }
+ }
children.assertCount(4)
}