aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-05-11 18:29:35 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2017-05-11 18:29:35 +0300
commit022a6a6bc9a1d61f190715dec56c3bef31887388 (patch)
tree5e30f2c8b233b2e6a607b5cc16730c8c6ffa35ba /core
parent281477a1f14214d5ef6cf246ee0a72697503ef03 (diff)
downloaddokka-022a6a6bc9a1d61f190715dec56c3bef31887388.tar.gz
dokka-022a6a6bc9a1d61f190715dec56c3bef31887388.tar.bz2
dokka-022a6a6bc9a1d61f190715dec56c3bef31887388.zip
Do not publish private companion object members in public only mode
#KT-16418 fixed
Diffstat (limited to 'core')
-rw-r--r--core/src/main/kotlin/Kotlin/DocumentationBuilder.kt2
-rw-r--r--core/src/test/kotlin/model/ClassTest.kt10
-rw-r--r--core/testdata/classes/privateCompanionObject.kt11
3 files changed, 22 insertions, 1 deletions
diff --git a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
index b034a299..4dae3a54 100644
--- a/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
+++ b/core/src/main/kotlin/Kotlin/DocumentationBuilder.kt
@@ -548,7 +548,7 @@ class DocumentationBuilder
.mapTo(result) { ClassMember(it, extraModifier = "static") }
val companionObjectDescriptor = companionObjectDescriptor
- if (companionObjectDescriptor != null) {
+ if (companionObjectDescriptor != null && companionObjectDescriptor.isDocumented(options)) {
val descriptors = companionObjectDescriptor.defaultType.memberScope.getContributedDescriptors()
val descriptorsToDocument = descriptors.filter { it !is CallableDescriptor || !it.isInheritedFromAny() }
descriptorsToDocument.mapTo(result) {
diff --git a/core/src/test/kotlin/model/ClassTest.kt b/core/src/test/kotlin/model/ClassTest.kt
index fb225728..f8baf251 100644
--- a/core/src/test/kotlin/model/ClassTest.kt
+++ b/core/src/test/kotlin/model/ClassTest.kt
@@ -280,4 +280,14 @@ class ClassTest {
}
}
}
+
+ @Test fun privateCompanionObject() {
+ verifyModel("testdata/classes/privateCompanionObject.kt", includeNonPublic = false) { model ->
+ with(model.members.single().members.single()) {
+ assertEquals(0, members(NodeKind.CompanionObjectFunction).size)
+ assertEquals(0, members(NodeKind.CompanionObjectProperty).size)
+ }
+ }
+ }
+
}
diff --git a/core/testdata/classes/privateCompanionObject.kt b/core/testdata/classes/privateCompanionObject.kt
new file mode 100644
index 00000000..df43b5f9
--- /dev/null
+++ b/core/testdata/classes/privateCompanionObject.kt
@@ -0,0 +1,11 @@
+package p
+
+class Clz {
+ private companion object {
+ fun fuun() {
+
+ }
+
+ val aaaa = 0
+ }
+} \ No newline at end of file