aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-10-04 06:40:29 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-10-04 06:40:29 +0300
commitdd432c8283b9c4a4aa98ae79a5fa4cbc07ec63fd (patch)
treedaf5bd2f74a5830ee2dc6956bf955b58e1605d6d /core/src/main/kotlin
parent4e24de5649be49a186e67000b5cd0ddc415d0366 (diff)
downloaddokka-dd432c8283b9c4a4aa98ae79a5fa4cbc07ec63fd.tar.gz
dokka-dd432c8283b9c4a4aa98ae79a5fa4cbc07ec63fd.tar.bz2
dokka-dd432c8283b9c4a4aa98ae79a5fa4cbc07ec63fd.zip
Add specialization instead of platform sub-duplication removal
Diffstat (limited to 'core/src/main/kotlin')
-rw-r--r--core/src/main/kotlin/Generation/DocumentationMerger.kt21
1 files changed, 15 insertions, 6 deletions
diff --git a/core/src/main/kotlin/Generation/DocumentationMerger.kt b/core/src/main/kotlin/Generation/DocumentationMerger.kt
index b29c2915..f58d2f8e 100644
--- a/core/src/main/kotlin/Generation/DocumentationMerger.kt
+++ b/core/src/main/kotlin/Generation/DocumentationMerger.kt
@@ -127,12 +127,21 @@ class DocumentationMerger(
singleNode.dropReferences { it.kind == RefKind.Owner }
return singleNode
}
- val nodeWithMaxPlatforms = nodes.maxBy { it.platforms.size }!!
- val maxPlatforms = nodeWithMaxPlatforms.platforms.toSet()
- val notContained = nodes.filterNot { maxPlatforms.containsAll(it.platforms) }
- val reducedDuplicates = listOf(nodeWithMaxPlatforms) + notContained
- if (!reducedDuplicates.containsAll(nodes)) {
- return mergeMembersWithEqualSignature(signature, reducedDuplicates)
+
+ // Specialization processing
+ // Given (Common, JVM, JRE6, JS) and (JVM, JRE6) and (JVM, JRE7)
+ // Sorted: (JVM, JRE6), (JVM, JRE7), (Common, JVM, JRE6, JS)
+ // Should output: (JVM, JRE6), (JVM, JRE7), (Common, JS)
+ // Should not remove first platform
+ val nodesSortedByPlatformCount = nodes.sortedBy { it.platforms.size }
+ val allPlatforms = mutableSetOf<String>()
+ nodesSortedByPlatformCount.forEach { node ->
+ node.platforms
+ .filterNot { allPlatforms.add(it) }
+ .filter { it != node.platforms.first() }
+ .forEach { platform ->
+ node.dropReferences { it.kind == RefKind.Platform && it.to.name == platform }
+ }
}
val groupNode = DocumentationNode(nodes.first().name, Content.Empty, NodeKind.GroupNode)