From e1dad14904ca0e3b727cf0d7239db35f5402e775 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Thu, 19 Dec 2019 15:02:03 +0100 Subject: Resolved problems with plugins loading ordering and added type safe ordering function --- .idea/jarRepositories.xml | 80 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .idea/jarRepositories.xml (limited to '.idea/jarRepositories.xml') diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 00000000..d92018c5 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit From e3ffd929230b675af020a707ea12923637b56872 Mon Sep 17 00:00:00 2001 From: BarkingBad <32793002+BarkingBad@users.noreply.github.com> Date: Wed, 8 Jan 2020 08:40:12 +0100 Subject: Delete accidentally added idea file --- .idea/jarRepositories.xml | 80 ----------------------------------------------- 1 file changed, 80 deletions(-) delete mode 100644 .idea/jarRepositories.xml (limited to '.idea/jarRepositories.xml') diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml deleted file mode 100644 index d92018c5..00000000 --- a/.idea/jarRepositories.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file -- cgit From aca9ac636f97a1eab75eae648a7e5b5c6305b5c7 Mon Sep 17 00:00:00 2001 From: Paweł Marks Date: Wed, 15 Jan 2020 15:39:07 +0100 Subject: Information about generics and nullability is no longer lost also removed obsolete and commented tests --- .idea/jarRepositories.xml | 80 ++++++++++++++++++++++++++ core/src/main/kotlin/links/DRI.kt | 111 +++++++++++++----------------------- core/src/test/kotlin/dri/DRITest.kt | 74 ------------------------ 3 files changed, 119 insertions(+), 146 deletions(-) create mode 100644 .idea/jarRepositories.xml delete mode 100644 core/src/test/kotlin/dri/DRITest.kt (limited to '.idea/jarRepositories.xml') diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 00000000..8e7bd752 --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/src/main/kotlin/links/DRI.kt b/core/src/main/kotlin/links/DRI.kt index 2ece58e5..0fe2900b 100644 --- a/core/src/main/kotlin/links/DRI.kt +++ b/core/src/main/kotlin/links/DRI.kt @@ -69,15 +69,12 @@ data class Callable( } sealed class TypeReference { + abstract val isNullable: Boolean companion object { fun from(d: ReceiverParameterDescriptor): TypeReference? = - when (val value = d.value) { - is ExtensionReceiver -> Bound( - fullyQualifiedName = value.type.constructorName.orEmpty(), - params = value.type.arguments.map { from(it) }, - isNullable = value.type.isMarkedNullable - ) + when (d.value) { + is ExtensionReceiver -> from(d.type) else -> run { println("Unknown value type for $d") null @@ -87,83 +84,53 @@ sealed class TypeReference { fun from(d: ValueParameterDescriptor): TypeReference? = from(d.type) - private fun from(tp: TypeParameterDescriptor, r: KotlinType?): Param = - Param(tp.upperBounds.map { from(it, r) }) - - - private fun from(t: KotlinType, r: KotlinType? = null): TypeReference = - if(t == r) - Self - else - when (val d = t.constructor.declarationDescriptor) { - is TypeParameterDescriptor -> from(d, r ?: t) - else -> Bound(t.constructorName.orEmpty(), t.arguments.map { from(it, r ?: t) }, t.isMarkedNullable) - } + private fun from(t: KotlinType, self: KotlinType? = null): TypeReference = + if (t == self) + if (t.isMarkedNullable) NullableSelfType else SelfType + else when (val d = t.constructor.declarationDescriptor) { + is TypeParameterDescriptor -> TypeParam( + d.upperBounds.map { from(it, self ?: t) }, + t.isMarkedNullable + ) + else -> TypeConstructor( + t.constructorName.orEmpty(), + t.arguments.map { from(it, self) }, + t.isMarkedNullable + ) + } private fun from(t: TypeProjection, r: KotlinType? = null): TypeReference = if (t.isStarProjection) { - starProjection + TypeConstructor("kotlin.Any", emptyList(), isNullable = true) } else { from(t.type, r) } - - private val starProjection = Param(listOf(Bound("*", emptyList(), true))) } } -data class Param(val bounds: List) : TypeReference() -data class Bound(val fullyQualifiedName: String, val params: List, val isNullable: Boolean) : TypeReference() { - override fun toString() = fullyQualifiedName + if (params.isNotEmpty()) { - "[${params.joinToString(",")}]" //TODO params can be Param or Self, handle naming - } else { - "" - } + +data class TypeParam(val bounds: List, override val isNullable: Boolean) : TypeReference() + +data class TypeConstructor( + val fullyQualifiedName: String, + val params: List, + override val isNullable: Boolean +) : TypeReference() { + override fun toString() = fullyQualifiedName + + (if (params.isNotEmpty()) "[${params.joinToString(",")}]" else "") + + if (isNullable) "?" else "" +} + +object SelfType : TypeReference() { + override val isNullable = false + override fun toString() = "^" +} + +object NullableSelfType : TypeReference() { + override val isNullable = true + override fun toString() = "^?" } -object Self : TypeReference() - - -//data class TypeReference(val classNames: String, val typeBounds: List = emptyList()) { -// override fun toString() = classNames + if (typeBounds.isNotEmpty()) { -// "[${typeBounds.joinToString(",")}]" -// } else { -// "" -// } -// -// companion object { -// fun from(d: ReceiverParameterDescriptor): TypeReference? = -// when (val value = d.value) { -// is ExtensionReceiver -> TypeReference( -// classNames = value.type.constructorName.orEmpty(), -// typeBounds = value.type.arguments.map { from(it) } -// ) -// else -> run { -// println("Unknown value type for $d") -// null -// } -// } -// -// fun from(d: ValueParameterDescriptor): TypeReference? = from(d.type) -// -// private fun from(tp: TypeParameterDescriptor): TypeReference = -// TypeReference("", tp.upperBounds.map { from(it) }) -// -// private fun from(t: KotlinType): TypeReference = -// when (val d = t.constructor.declarationDescriptor) { -// is TypeParameterDescriptor -> from(d) -// else -> TypeReference(t.constructorName.orEmpty(), t.arguments.map { from(it) }) -// } -// -// private fun from(t: TypeProjection): TypeReference = -// if (t.isStarProjection) { -// starProjection -// } else { -// from(t.type) -// } -// -// val starProjection = TypeReference("*") -// } -//} private operator fun List.component6(): T = get(5) diff --git a/core/src/test/kotlin/dri/DRITest.kt b/core/src/test/kotlin/dri/DRITest.kt deleted file mode 100644 index 911e49bf..00000000 --- a/core/src/test/kotlin/dri/DRITest.kt +++ /dev/null @@ -1,74 +0,0 @@ -package org.jetbrains.dokka.tests.dri - -import org.jetbrains.dokka.links.Callable -import org.jetbrains.dokka.links.TypeReference -import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.resolvers.toJavadocLocation -import org.junit.Test -import kotlin.test.assertEquals - -class DRITest { -// @Test -// fun onlyClassNames() { -// val expected = DRI(classNames = "className1.className2") -// val actual = DRI.from("/className1.className2////") -// assertEquals(expected, actual) -// } - -// @Test -// fun fullDRI() { -// val expected = DRI("org.dokka", "className1.className2", Callable("", "", listOf("Int")), 2, "something") -// val actual = DRI.from("org.dokka/className1.className2//..Int/2/something") -// assertEquals(expected, actual) -// } - -// @Test -// fun onlyExtra() { -// val expected = DRI(null, null, null, null, "extra") -// val actual = DRI.from("/////extra") -// assertEquals(expected, actual) -// } -// -// @Test -// fun javadoc8Location() { -// val dri = DRI("org.jetbrains.dokka", "DRITest", "javadocLocation", ".void.") -// assertEquals("org/jetbrains/dokka/DRITest.html#javadocLocation--", dri.toJavadocLocation(8)) -// } -// -// @Test -// fun parseDRI() { -// val toParse = -// "example//baz/example.Foo[kotlin.Comparable[*],[kotlin.collections.List[example.ReBarBar],kotlin.Comparable[*]]]#[kotlin.collections.List[example.ReBarBar],kotlin.Comparable[*]]//" -// val dri = DRI( -// "example", -// "", -// Callable( -// "baz", -// TypeReference( -// "example.Foo", listOf( -// TypeReference("kotlin.Comparable", listOf(TypeReference.starProjection)), -// TypeReference( -// "", listOf( -// TypeReference("kotlin.collections.List", listOf(TypeReference("example.ReBarBar"))), -// TypeReference("kotlin.Comparable", listOf(TypeReference.starProjection)) -// ) -// ) -// ) -// ), -// listOf( -// TypeReference( -// "", -// listOf( -// TypeReference("kotlin.collections.List", listOf(TypeReference("example.ReBarBar"))), -// TypeReference("kotlin.Comparable", listOf(TypeReference.starProjection)) -// ) -// -// ) -// ) -// ) -// ) -// assertEquals(dri.toString(), DRI.from(toParse).toString()) -// } -} - - -- cgit From 0073c4c547dafaae5d465d4c410a52fd7fdc818d Mon Sep 17 00:00:00 2001 From: Kamil Doległo Date: Fri, 24 Jan 2020 14:41:33 +0100 Subject: Cherry-pick 'analysis_rewrite_1.3.61' --- .idea/codeStyles/codeStyleConfig.xml | 1 + .idea/compiler.xml | 2 + .idea/jarRepositories.xml | 10 + build.gradle | 45 +-- core/build.gradle | 3 +- .../main/kotlin/analysis/AnalysisEnvironment.kt | 375 ++++++++++++++------- .../main/kotlin/analysis/CoreKotlinCacheService.kt | 18 +- .../main/kotlin/analysis/CoreProjectFileIndex.kt | 11 +- .../main/kotlin/analysis/DokkaAnalyzerFacades.kt | 164 --------- .../main/kotlin/analysis/JavaResolveExtension.kt | 7 +- .../DefaultDocumentationNodeMerger.kt | 3 +- coreDependencies/build.gradle | 23 +- gradle.properties | 8 +- .../dokka/gradle/MultiplatformProjectTest.kt | 4 +- 14 files changed, 321 insertions(+), 353 deletions(-) delete mode 100644 core/src/main/kotlin/analysis/DokkaAnalyzerFacades.kt (limited to '.idea/jarRepositories.xml') diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml index 79ee123c..6e6eec11 100644 --- a/.idea/codeStyles/codeStyleConfig.xml +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -1,5 +1,6 @@ \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml index f165d41a..feb731d8 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -58,6 +58,8 @@ + + diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml index 8e7bd752..b5925b37 100644 --- a/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -76,5 +76,15 @@