From 0ff8ebe97f540fff0d6fac962749f73b1db689ef Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Fri, 12 Jun 2020 09:51:31 +0200 Subject: Change sourceSet collection from List to Set --- core/src/main/kotlin/model/Documentable.kt | 28 ++++++++++++------------- core/src/main/kotlin/model/documentableUtils.kt | 8 +++---- 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'core/src') diff --git a/core/src/main/kotlin/model/Documentable.kt b/core/src/main/kotlin/model/Documentable.kt index c4dabb3b..feab34c5 100644 --- a/core/src/main/kotlin/model/Documentable.kt +++ b/core/src/main/kotlin/model/Documentable.kt @@ -13,7 +13,7 @@ abstract class Documentable { abstract val dri: DRI abstract val children: List abstract val documentation: SourceSetDependent - abstract val sourceSets: List + abstract val sourceSets: Set abstract val expectPresentInSet: SourceSetData? override fun toString(): String = @@ -91,7 +91,7 @@ data class DModule( val packages: List, override val documentation: SourceSetDependent, override val expectPresentInSet: SourceSetData? = null, - override val sourceSets: List, + override val sourceSets: Set, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), WithExtraProperties { override val dri: DRI = DRI.topLevel @@ -109,7 +109,7 @@ data class DPackage( val typealiases: List, override val documentation: SourceSetDependent, override val expectPresentInSet: SourceSetData? = null, - override val sourceSets: List, + override val sourceSets: Set, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), WithScope, WithExtraProperties { override val name = dri.packageName.orEmpty() @@ -134,7 +134,7 @@ data class DClass( override val documentation: SourceSetDependent, override val expectPresentInSet: SourceSetData?, override val modifier: SourceSetDependent, - override val sourceSets: List, + override val sourceSets: Set, override val extra: PropertyContainer = PropertyContainer.empty() ) : DClasslike(), WithAbstraction, WithCompanion, WithConstructors, WithGenerics, WithSupertypes, WithExtraProperties { @@ -159,7 +159,7 @@ data class DEnum( override val companion: DObject?, override val constructors: List, override val supertypes: SourceSetDependent>, - override val sourceSets: List, + override val sourceSets: Set, override val extra: PropertyContainer = PropertyContainer.empty() ) : DClasslike(), WithCompanion, WithConstructors, WithSupertypes, WithExtraProperties { override val children: List @@ -176,7 +176,7 @@ data class DEnumEntry( override val functions: List, override val properties: List, override val classlikes: List, - override val sourceSets: List, + override val sourceSets: Set, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), WithScope, WithExtraProperties { override val children: List @@ -198,7 +198,7 @@ data class DFunction( override val generics: List, override val receiver: DParameter?, override val modifier: SourceSetDependent, - override val sourceSets: List, + override val sourceSets: Set, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), Callable, WithGenerics, WithExtraProperties { override val children: List @@ -220,7 +220,7 @@ data class DInterface( override val companion: DObject?, override val generics: List, override val supertypes: SourceSetDependent>, - override val sourceSets: List, + override val sourceSets: Set, override val extra: PropertyContainer = PropertyContainer.empty() ) : DClasslike(), WithCompanion, WithGenerics, WithSupertypes, WithExtraProperties { override val children: List @@ -240,7 +240,7 @@ data class DObject( override val classlikes: List, override val visibility: SourceSetDependent, override val supertypes: SourceSetDependent>, - override val sourceSets: List, + override val sourceSets: Set, override val extra: PropertyContainer = PropertyContainer.empty() ) : DClasslike(), WithSupertypes, WithExtraProperties { override val children: List @@ -262,7 +262,7 @@ data class DAnnotation( override val companion: DObject?, override val constructors: List, override val generics: List, - override val sourceSets: List, + override val sourceSets: Set, override val extra: PropertyContainer = PropertyContainer.empty() ) : DClasslike(), WithCompanion, WithConstructors, WithExtraProperties, WithGenerics { override val children: List @@ -283,7 +283,7 @@ data class DProperty( val setter: DFunction?, val getter: DFunction?, override val modifier: SourceSetDependent, - override val sourceSets: List, + override val sourceSets: Set, override val generics: List, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), Callable, WithExtraProperties, WithGenerics { @@ -300,7 +300,7 @@ data class DParameter( override val documentation: SourceSetDependent, override val expectPresentInSet: SourceSetData?, val type: Bound, - override val sourceSets: List, + override val sourceSets: Set, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), WithExtraProperties { override val children: List @@ -315,7 +315,7 @@ data class DTypeParameter( override val documentation: SourceSetDependent, override val expectPresentInSet: SourceSetData?, val bounds: List, - override val sourceSets: List, + override val sourceSets: Set, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), WithExtraProperties { override val children: List @@ -332,7 +332,7 @@ data class DTypeAlias( override val visibility: SourceSetDependent, override val documentation: SourceSetDependent, override val expectPresentInSet: SourceSetData?, - override val sourceSets: List, + override val sourceSets: Set, override val extra: PropertyContainer = PropertyContainer.empty() ) : Documentable(), WithType, WithVisibility, WithExtraProperties { override val children: List diff --git a/core/src/main/kotlin/model/documentableUtils.kt b/core/src/main/kotlin/model/documentableUtils.kt index b09260ee..2d4ade15 100644 --- a/core/src/main/kotlin/model/documentableUtils.kt +++ b/core/src/main/kotlin/model/documentableUtils.kt @@ -1,12 +1,12 @@ package org.jetbrains.dokka.model -fun SourceSetDependent.filtered(platformDataList: List) = filter { it.key in platformDataList } -fun SourceSetData?.filtered(platformDataList: List) = takeIf { this in platformDataList } +fun SourceSetDependent.filtered(platformDataList: Set) = filter { it.key in platformDataList } +fun SourceSetData?.filtered(platformDataList: Set) = takeIf { this in platformDataList } -fun DTypeParameter.filter(filteredData: List) = +fun DTypeParameter.filter(filteredData: Set) = if (filteredData.containsAll(sourceSets)) this else { - val intersection = filteredData.intersect(sourceSets).toList() + val intersection = filteredData.intersect(sourceSets) if (intersection.isEmpty()) null else DTypeParameter( dri, -- cgit