aboutsummaryrefslogtreecommitdiff
path: root/kotlin-analysis/src/main
diff options
context:
space:
mode:
authorVadim Mishenev <vad-mishenev@yandex.ru>2022-05-31 23:57:28 +0300
committerGitHub <noreply@github.com>2022-05-31 23:57:28 +0300
commit73f78dc34bbcb683f345192629bdbc631035887e (patch)
tree1ebdd3d0312c3742cfcfc0b199b26fb0d5a57f47 /kotlin-analysis/src/main
parent623cf222ca2ac5e8b9628af5927956ecb6d44d1e (diff)
downloaddokka-73f78dc34bbcb683f345192629bdbc631035887e.tar.gz
dokka-73f78dc34bbcb683f345192629bdbc631035887e.tar.bz2
dokka-73f78dc34bbcb683f345192629bdbc631035887e.zip
Bump Kotlin to 1.7.0-RC (#2508)
* `UnresolvedType` is replaced with `ErrorType` in https://github.com/JetBrains/kotlin/commit/b5933c70e20a0dfd788d8d4a6c04ca0d16f7c731 * Support `sig` files in https://github.com/JetBrains/kotlin/commit/22b368849338cae684601c9b1ead31ebb1fd81cf * `org.jetbrains.kotlin.idea.kdoc.resolveKDocSampleLink` is removed in https://github.com/JetBrains/intellij-community/commit/e4af6f96c8d4e2318d04eddf658a4c4e8c60b2e6 * `org.jetbrains.kotlin.idea.refactoring.fqName.getKotlinFqName` is deprecated * `org.codehaus.plexus.archiver.AbstractArchiver.addDirectory` is deprecated https://codehaus-plexus.github.io/plexus-archiver/apidocs/org/codehaus/plexus/archiver/Archiver.html#addDirectory-java.io.File-java.lang.String:A-java.lang.String:A- * Make `clean` independent from `setupMaven` * Set up JDK classpath roots explicitly because of https://github.com/JetBrains/kotlin/commit/f89765eb33dd95c8de33a919cca83651b326b246 * Add JPS model and faxml dependencies * Fix test * Exclude compiler from buildscript in integration test * Exclude `com.intellij` package from compiler * Update kotlin version in integration tests
Diffstat (limited to 'kotlin-analysis/src/main')
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt2
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/CoreKotlinCacheService.kt4
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt2
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/JvmDependenciesIndexImpl.kt1
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/KotlinCliJavaFileManagerImpl.kt5
-rw-r--r--kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt16
6 files changed, 22 insertions, 8 deletions
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt
index 48162097..9efa66fb 100644
--- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt
+++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/AnalysisEnvironment.kt
@@ -542,6 +542,8 @@ class AnalysisEnvironment(val messageCollector: MessageCollector, val analysisPl
}
}
+ // Set up JDK classpath roots explicitly because of https://github.com/JetBrains/kotlin/commit/f89765eb33dd95c8de33a919cca83651b326b246
+ fun configureJdkClasspathRoots() = configuration.configureJdkClasspathRoots()
/**
* Adds path to classpath.
* $path: path to add
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/CoreKotlinCacheService.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/CoreKotlinCacheService.kt
index 12cc3351..e2cd328a 100644
--- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/CoreKotlinCacheService.kt
+++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/CoreKotlinCacheService.kt
@@ -15,6 +15,10 @@ class CoreKotlinCacheService(private val resolutionFacade: DokkaResolutionFacade
return resolutionFacade
}
+ override fun getResolutionFacade(element: KtElement): ResolutionFacade {
+ return resolutionFacade
+ }
+
override fun getResolutionFacadeByFile(
file: PsiFile,
platform: org.jetbrains.kotlin.platform.TargetPlatform
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt
index 90958ff3..60ad3315 100644
--- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt
+++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/EnvironmentAndFacade.kt
@@ -17,7 +17,7 @@ internal fun createEnvironmentAndFacade(
): EnvironmentAndFacade =
AnalysisEnvironment(DokkaMessageCollector(logger), sourceSet.analysisPlatform).run {
if (analysisPlatform == Platform.jvm) {
- addClasspath(PathUtil.getJdkClassesRootsFromCurrentJre())
+ configureJdkClasspathRoots()
}
val parentSourceSets = sourceSets.filter { it.sourceSetID in sourceSet.dependentSourceSets }
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/JvmDependenciesIndexImpl.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/JvmDependenciesIndexImpl.kt
index c64f2fab..1075665e 100644
--- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/JvmDependenciesIndexImpl.kt
+++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/JvmDependenciesIndexImpl.kt
@@ -209,6 +209,7 @@ class JvmDependenciesIndexImpl(_roots: List<JavaRoot>) : JvmDependenciesIndex {
val fileExtension = when (rootType) {
JavaRoot.RootType.BINARY -> JavaClassFileType.INSTANCE.defaultExtension
+ JavaRoot.RootType.BINARY_SIG -> "sig"
JavaRoot.RootType.SOURCE -> JavaFileType.INSTANCE.defaultExtension
}
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/KotlinCliJavaFileManagerImpl.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/KotlinCliJavaFileManagerImpl.kt
index 5955c3e4..37a5e3f7 100644
--- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/KotlinCliJavaFileManagerImpl.kt
+++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/KotlinCliJavaFileManagerImpl.kt
@@ -90,7 +90,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
val (classId, classFileContentFromRequest, outerClassFromRequest) = request
val virtualFile = findVirtualFileForTopLevelClass(classId, searchScope) ?: return null
- if (!usePsiClassFilesReading && virtualFile.extension == "class") {
+ if (!usePsiClassFilesReading && (virtualFile.extension == "class" || virtualFile.extension == "sig")) {
synchronized(binaryCache){
// We return all class files' names in the directory in knownClassNamesInPackage method, so one may request an inner class
return binaryCache.getOrPut(classId) {
@@ -215,6 +215,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
val vFile = when (rootType) {
JavaRoot.RootType.BINARY -> packageDir.findChild("$topLevelClassName.class")
+ JavaRoot.RootType.BINARY_SIG -> packageDir.findChild("$topLevelClassName.sig")
JavaRoot.RootType.SOURCE -> packageDir.findChild("$topLevelClassName.java")
} ?: return null
@@ -235,7 +236,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ
val result = THashSet<String>()
index.traverseDirectoriesInPackage(packageFqName, continueSearch = { dir, _ ->
for (child in dir.children) {
- if (child.extension == "class" || child.extension == "java") {
+ if (child.extension == "class" || child.extension == "java" || child.extension == "sig") {
result.add(child.nameWithoutExtension)
}
}
diff --git a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt
index 22660ecc..091e54ce 100644
--- a/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt
+++ b/kotlin-analysis/src/main/kotlin/org/jetbrains/dokka/analysis/TypeReferenceFactory.kt
@@ -9,7 +9,9 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.fqNameSafe
import org.jetbrains.kotlin.resolve.scopes.receivers.ExtensionReceiver
import org.jetbrains.kotlin.types.KotlinType
import org.jetbrains.kotlin.types.TypeProjection
-import org.jetbrains.kotlin.types.UnresolvedType
+import org.jetbrains.kotlin.types.error.ErrorType
+import org.jetbrains.kotlin.types.error.ErrorTypeConstructor
+import org.jetbrains.kotlin.types.error.ErrorTypeKind
fun TypeReference.Companion.from(d: ReceiverParameterDescriptor): TypeReference? =
when (d.value) {
@@ -35,10 +37,14 @@ private fun TypeReference.Companion.fromPossiblyRecursive(t: KotlinType, paramTr
?: from(t, paramTrace)
private fun TypeReference.Companion.from(t: KotlinType, paramTrace: List<KotlinType>): TypeReference {
- if (t is UnresolvedType) {
- return TypeConstructor(
- t.presentableName, t.arguments.map { fromProjection(it, paramTrace) }
- )
+ if (t is ErrorType) {
+ val errorConstructor = t.constructor as? ErrorTypeConstructor
+ val presentableName =
+ if (errorConstructor?.kind == ErrorTypeKind.UNRESOLVED_TYPE && errorConstructor.parameters.isNotEmpty())
+ errorConstructor.getParam(0)
+ else
+ t.constructor.toString()
+ return TypeConstructor(presentableName, t.arguments.map { fromProjection(it, paramTrace) })
}
return when (val d = t.constructor.declarationDescriptor) {
is TypeParameterDescriptor -> TypeParam(