diff options
Diffstat (limited to 'subprojects/analysis-kotlin-descriptors')
2 files changed, 9 insertions, 33 deletions
diff --git a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/JvmDependenciesIndexImpl.kt b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/JvmDependenciesIndexImpl.kt index 7cc41600..da18a952 100644 --- a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/JvmDependenciesIndexImpl.kt +++ b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/JvmDependenciesIndexImpl.kt @@ -1,17 +1,5 @@ /* - * Copyright 2010-2016 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ /** @@ -40,7 +28,7 @@ import kotlin.concurrent.withLock // speeds up finding files/classes in classpath/java source roots // TODO: KT-58327 needs to be adapted/removed if we want compiler to be multithreaded // the main idea of this class is for each package to store roots which contains it to avoid excessive file system traversal -class JvmDependenciesIndexImpl(_roots: List<JavaRoot>) : JvmDependenciesIndex { +public class JvmDependenciesIndexImpl(_roots: List<JavaRoot>) : JvmDependenciesIndex { private val lock = ReentrantLock() //these fields are computed based on _roots passed to constructor which are filled in later @@ -76,7 +64,7 @@ class JvmDependenciesIndexImpl(_roots: List<JavaRoot>) : JvmDependenciesIndex { // helps improve several scenarios, LazyJavaResolverContext.findClassInJava being the most important private var lastClassSearch: Pair<FindClassRequest, SearchResult>? = null - override val indexedRoots by lazy { roots.asSequence() } + override val indexedRoots: Sequence<JavaRoot> by lazy { roots.asSequence() } private val packageCache: Array<out MutableMap<String, VirtualFile?>> by lazy { Array(roots.size) { THashMap<String, VirtualFile?>() } @@ -266,4 +254,4 @@ class JvmDependenciesIndexImpl(_roots: List<JavaRoot>) : JvmDependenciesIndex { object NotFound : SearchResult() } -}
\ No newline at end of file +} diff --git a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/KotlinCliJavaFileManagerImpl.kt b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/KotlinCliJavaFileManagerImpl.kt index deb09274..3d340672 100644 --- a/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/KotlinCliJavaFileManagerImpl.kt +++ b/subprojects/analysis-kotlin-descriptors/compiler/src/main/kotlin/org/jetbrains/dokka/analysis/kotlin/descriptors/compiler/configuration/KotlinCliJavaFileManagerImpl.kt @@ -1,17 +1,5 @@ /* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ /** @@ -53,7 +41,7 @@ import org.jetbrains.kotlin.util.PerformanceCounter // TODO: do not inherit from CoreJavaFileManager to avoid accidental usage of its methods which do not use caches/indices // Currently, the only relevant usage of this class as CoreJavaFileManager is at CoreJavaDirectoryService.getPackage, // which is indirectly invoked from PsiPackage.getSubPackages -class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJavaFileManager(myPsiManager), KotlinCliJavaFileManager { +public class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJavaFileManager(myPsiManager), KotlinCliJavaFileManager { private val perfCounter = PerformanceCounter.create("Find Java class") private lateinit var index: JvmDependenciesIndex private lateinit var singleJavaFileRootsIndex: SingleJavaFileRootsIndex @@ -62,7 +50,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ private val allScope = GlobalSearchScope.allScope(myPsiManager.project) private var usePsiClassFilesReading = false - fun initialize( + public fun initialize( index: JvmDependenciesIndex, packagePartProviders: List<JvmPackagePartProvider>, singleJavaFileRootsIndex: SingleJavaFileRootsIndex, @@ -92,7 +80,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ private val binaryCache: MutableMap<ClassId, JavaClass?> = THashMap() private val signatureParsingComponent = BinaryClassSignatureParser() - fun findClass(classId: ClassId, searchScope: GlobalSearchScope): JavaClass? = findClass(JavaClassFinder.Request(classId), searchScope) + public fun findClass(classId: ClassId, searchScope: GlobalSearchScope): JavaClass? = findClass(JavaClassFinder.Request(classId), searchScope) override fun findClass(request: JavaClassFinder.Request, searchScope: GlobalSearchScope): JavaClass? { val (classId, classFileContentFromRequest, outerClassFromRequest) = request @@ -266,7 +254,7 @@ class KotlinCliJavaFileManagerImpl(private val myPsiManager: PsiManager) : CoreJ override fun getNonTrivialPackagePrefixes(): Collection<String> = emptyList() - companion object { + public companion object { private val LOG = Logger.getInstance(KotlinCliJavaFileManagerImpl::class.java) private fun findClassInPsiFile(classNameWithInnerClassesDotSeparated: String, file: PsiClassOwner): PsiClass? { |