Hack for checking access to internal declarations during incremental compilation
This commit is contained in:
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.descriptors.*
|
||||
import org.jetbrains.kotlin.load.kotlin.ModuleVisibilityManager
|
||||
import org.jetbrains.kotlin.load.kotlin.getSourceElement
|
||||
import org.jetbrains.kotlin.load.kotlin.isContainedByCompiledPartOfOurModule
|
||||
import org.jetbrains.kotlin.load.kotlin.isFromIncrementalPackageFragment
|
||||
import org.jetbrains.kotlin.modules.Module
|
||||
import org.jetbrains.kotlin.resolve.lazy.descriptors.LazyPackageDescriptor
|
||||
import org.jetbrains.kotlin.resolve.source.KotlinSourceElement
|
||||
@@ -59,6 +60,10 @@ class ModuleVisibilityHelperImpl : ModuleVisibilityHelper {
|
||||
|
||||
if (modules.isEmpty()) return false
|
||||
|
||||
// Hack for incremental compilation (now there is no way to determine the module of descriptor in case of incremental package fragment)
|
||||
// TODO Implement full check for access to internal for incremental compilation
|
||||
if (what.isFromIncrementalPackageFragment) return true
|
||||
|
||||
return findModule(from, modules) === findModule(what, modules)
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,10 @@ interface ModuleVisibilityManager {
|
||||
}
|
||||
}
|
||||
|
||||
public val DeclarationDescriptor.isFromIncrementalPackageFragment: Boolean
|
||||
get() =
|
||||
DescriptorUtils.getParentOfType(this, PackageFragmentDescriptor::class.java, false) is IncrementalPackageFragmentProvider.IncrementalPackageFragment
|
||||
|
||||
public fun isContainedByCompiledPartOfOurModule(descriptor: DeclarationDescriptor, outDirectory: File?): Boolean {
|
||||
val packageFragment = DescriptorUtils.getParentOfType(descriptor, PackageFragmentDescriptor::class.java, false)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user