diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/DescriptorBasedProperty.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/DescriptorBasedProperty.kt index c50fd847e47..f2e42cd5d12 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/DescriptorBasedProperty.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/DescriptorBasedProperty.kt @@ -21,7 +21,7 @@ import java.lang.reflect.Field import kotlin.reflect.jvm.internal.JvmPropertySignature.JavaField import kotlin.reflect.jvm.internal.JvmPropertySignature.KotlinProperty -abstract class DescriptorBasedProperty protected constructor( +internal abstract class DescriptorBasedProperty protected constructor( internal val container: KDeclarationContainerImpl, name: String, signature: String, diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KAnnotatedElementImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KAnnotatedElementImpl.kt index 57e2d1fe204..9bc0b850407 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KAnnotatedElementImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KAnnotatedElementImpl.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotated import org.jetbrains.kotlin.load.kotlin.reflect.ReflectAnnotationSource import kotlin.reflect.KAnnotatedElement -interface KAnnotatedElementImpl : KAnnotatedElement { +internal interface KAnnotatedElementImpl : KAnnotatedElement { val annotated: Annotated override val annotations: List diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt index 42ec1985f57..4ae44a55b75 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KCallableImpl.kt @@ -26,7 +26,7 @@ import kotlin.reflect.KType import kotlin.reflect.KotlinReflectionInternalError import kotlin.reflect.jvm.javaType -interface KCallableImpl : KCallable, KAnnotatedElementImpl { +internal interface KCallableImpl : KCallable, KAnnotatedElementImpl { val descriptor: CallableMemberDescriptor val caller: FunctionCaller<*> diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KClassImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KClassImpl.kt index d9416cb16ae..0d49a45cdd4 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KClassImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KClassImpl.kt @@ -37,7 +37,7 @@ import kotlin.reflect.KClass import kotlin.reflect.KFunction import kotlin.reflect.KotlinReflectionInternalError -class KClassImpl(override val jClass: Class) : KDeclarationContainerImpl(), KClass, KAnnotatedElementImpl { +internal class KClassImpl(override val jClass: Class) : KDeclarationContainerImpl(), KClass, KAnnotatedElementImpl { val descriptor by ReflectProperties.lazySoft { val classId = classId diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KDeclarationContainerImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KDeclarationContainerImpl.kt index d9a37fc547e..7c6a01b5cf8 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KDeclarationContainerImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KDeclarationContainerImpl.kt @@ -36,7 +36,7 @@ import kotlin.jvm.internal.ClassBasedDeclarationContainer import kotlin.reflect.KCallable import kotlin.reflect.KotlinReflectionInternalError -abstract class KDeclarationContainerImpl : ClassBasedDeclarationContainer { +internal abstract class KDeclarationContainerImpl : ClassBasedDeclarationContainer { // Note: this is stored here on a soft reference to prevent GC from destroying the weak reference to it in the moduleByClassLoader cache val moduleData by ReflectProperties.lazySoft { jClass.getOrCreateModule() diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionFromReferenceImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionFromReferenceImpl.kt index 71e9b8c5b3a..ab201008e76 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionFromReferenceImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionFromReferenceImpl.kt @@ -24,7 +24,7 @@ import kotlin.jvm.internal.FunctionReference import kotlin.reflect.KCallable import kotlin.reflect.KotlinReflectionInternalError -class KFunctionFromReferenceImpl( +internal class KFunctionFromReferenceImpl( val reference: FunctionReference ): KFunctionImpl( reference.getOwner() as? KDeclarationContainerImpl ?: EmptyContainerForLocal, @@ -62,7 +62,7 @@ class KFunctionFromReferenceImpl( override fun invoke(p1: Any?, p2: Any?, p3: Any?, p4: Any?, p5: Any?, p6: Any?, p7: Any?, p8: Any?, p9: Any?, p10: Any?, p11: Any?, p12: Any?, p13: Any?, p14: Any?, p15: Any?, p16: Any?, p17: Any?, p18: Any?, p19: Any?, p20: Any?, p21: Any?, p22: Any?): Any? = reference(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20, p21, p22) } -object EmptyContainerForLocal : KDeclarationContainerImpl() { +internal object EmptyContainerForLocal : KDeclarationContainerImpl() { override val jClass: Class<*> get() = fail() diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionImpl.kt index edd1d89a6b9..42f82c6d4aa 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KFunctionImpl.kt @@ -30,7 +30,7 @@ import kotlin.reflect.jvm.internal.JvmFunctionSignature.JavaConstructor import kotlin.reflect.jvm.internal.JvmFunctionSignature.JavaMethod import kotlin.reflect.jvm.internal.JvmFunctionSignature.KotlinFunction -open class KFunctionImpl protected constructor( +internal open class KFunctionImpl protected constructor( private val container: KDeclarationContainerImpl, name: String, signature: String, diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPackageImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPackageImpl.kt index 726c9e23228..3d2bea1fb81 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPackageImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPackageImpl.kt @@ -27,7 +27,7 @@ import kotlin.jvm.internal.KotlinPackage import kotlin.reflect.KCallable import kotlin.reflect.KPackage -class KPackageImpl(override val jClass: Class<*>, val moduleName: String) : KDeclarationContainerImpl(), KPackage { +internal class KPackageImpl(override val jClass: Class<*>, val moduleName: String) : KDeclarationContainerImpl(), KPackage { val descriptor by ReflectProperties.lazySoft { val moduleData = jClass.getOrCreateModule() moduleData.packageFacadeProvider.registerModule(moduleName) diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KParameterImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KParameterImpl.kt index 9c3410d3f04..cae8344ef27 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KParameterImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KParameterImpl.kt @@ -23,7 +23,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.hasDefaultValue import kotlin.reflect.KParameter import kotlin.reflect.KType -class KParameterImpl( +internal class KParameterImpl( val callable: KCallableImpl<*>, override val index: Int, override val kind: KParameter.Kind, diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty0Impl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty0Impl.kt index 8124bb802f8..165a35e74e1 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty0Impl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty0Impl.kt @@ -22,7 +22,7 @@ import kotlin.jvm.internal.PropertyReference0 import kotlin.reflect.KMutableProperty0 import kotlin.reflect.KProperty0 -open class KProperty0Impl : DescriptorBasedProperty, KProperty0, KPropertyImpl { +internal open class KProperty0Impl : DescriptorBasedProperty, KProperty0, KPropertyImpl { constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) @@ -36,7 +36,7 @@ open class KProperty0Impl : DescriptorBasedProperty, KProperty0, KP } } -open class KMutableProperty0Impl : KProperty0Impl, KMutableProperty0, KMutablePropertyImpl { +internal open class KMutableProperty0Impl : KProperty0Impl, KMutableProperty0, KMutablePropertyImpl { constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) @@ -51,7 +51,7 @@ open class KMutableProperty0Impl : KProperty0Impl, KMutableProperty0, K } -class KProperty0FromReferenceImpl( +internal class KProperty0FromReferenceImpl( val reference: PropertyReference0 ) : KProperty0Impl( reference.owner as KDeclarationContainerImpl, @@ -64,7 +64,7 @@ class KProperty0FromReferenceImpl( } -class KMutableProperty0FromReferenceImpl( +internal class KMutableProperty0FromReferenceImpl( val reference: MutablePropertyReference0 ) : KMutableProperty0Impl( reference.owner as KDeclarationContainerImpl, diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty1Impl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty1Impl.kt index b95760b773c..ab1dd395595 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty1Impl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty1Impl.kt @@ -22,7 +22,7 @@ import kotlin.jvm.internal.PropertyReference1 import kotlin.reflect.KMutableProperty1 import kotlin.reflect.KProperty1 -open class KProperty1Impl : DescriptorBasedProperty, KProperty1, KPropertyImpl { +internal open class KProperty1Impl : DescriptorBasedProperty, KProperty1, KPropertyImpl { constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) @@ -36,7 +36,7 @@ open class KProperty1Impl : DescriptorBasedProperty, KProperty1 : KProperty1Impl, KMutableProperty1, KMutablePropertyImpl { +internal open class KMutableProperty1Impl : KProperty1Impl, KMutableProperty1, KMutablePropertyImpl { constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) @@ -51,7 +51,7 @@ open class KMutableProperty1Impl : KProperty1Impl, KMutableProperty1 } -class KProperty1FromReferenceImpl( +internal class KProperty1FromReferenceImpl( val reference: PropertyReference1 ) : KProperty1Impl( reference.owner as KDeclarationContainerImpl, @@ -64,7 +64,7 @@ class KProperty1FromReferenceImpl( } -class KMutableProperty1FromReferenceImpl( +internal class KMutableProperty1FromReferenceImpl( val reference: MutablePropertyReference1 ) : KMutableProperty1Impl( reference.owner as KDeclarationContainerImpl, diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty2Impl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty2Impl.kt index 9ce7cb196fd..79f529b99ae 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty2Impl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KProperty2Impl.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.descriptors.PropertyDescriptor import kotlin.reflect.KMutableProperty2 import kotlin.reflect.KProperty2 -open class KProperty2Impl : DescriptorBasedProperty, KProperty2, KPropertyImpl { +internal open class KProperty2Impl : DescriptorBasedProperty, KProperty2, KPropertyImpl { constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) @@ -34,7 +34,7 @@ open class KProperty2Impl : DescriptorBasedProperty, KProperty2< } } -class KMutableProperty2Impl : KProperty2Impl, KMutableProperty2, KMutablePropertyImpl { +internal class KMutableProperty2Impl : KProperty2Impl, KMutableProperty2, KMutablePropertyImpl { constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPropertyImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPropertyImpl.kt index 7a27e7db248..f9629a7cd24 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPropertyImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPropertyImpl.kt @@ -25,10 +25,10 @@ import java.lang.reflect.Modifier import kotlin.reflect.KMutableProperty import kotlin.reflect.KProperty -interface KPropertyImpl : KProperty, KCallableImpl { - val javaField: Field? +internal interface KPropertyImpl : KProperty, KCallableImpl { + internal val javaField: Field? - val container: KDeclarationContainerImpl + internal val container: KDeclarationContainerImpl override val getter: Getter @@ -63,7 +63,7 @@ interface KPropertyImpl : KProperty, KCallableImpl { } -interface KMutablePropertyImpl : KMutableProperty, KPropertyImpl { +internal interface KMutablePropertyImpl : KMutableProperty, KPropertyImpl { override val setter: Setter abstract class Setter : KPropertyImpl.Accessor(), KMutableProperty.Setter, KCallableImpl { diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTypeImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTypeImpl.kt index 5dd64947279..e2f042051b3 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTypeImpl.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KTypeImpl.kt @@ -20,7 +20,7 @@ import org.jetbrains.kotlin.types.JetType import java.lang.reflect.Type import kotlin.reflect.KType -class KTypeImpl( +internal class KTypeImpl( val type: JetType, computeJavaType: () -> Type ) : KType { diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/ReflectionObjectRenderer.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/ReflectionObjectRenderer.kt index 852960034a6..48ff1e1f079 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/ReflectionObjectRenderer.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/ReflectionObjectRenderer.kt @@ -24,7 +24,7 @@ import org.jetbrains.kotlin.renderer.DescriptorRenderer import org.jetbrains.kotlin.types.JetType import kotlin.reflect.KParameter -object ReflectionObjectRenderer { +internal object ReflectionObjectRenderer { private val renderer = DescriptorRenderer.FQ_NAMES_IN_TYPES private fun StringBuilder.appendReceiverType(receiver: ReceiverParameterDescriptor?) { diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/RuntimeTypeMapper.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/RuntimeTypeMapper.kt index a195ee3b671..aa393b87248 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/RuntimeTypeMapper.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/RuntimeTypeMapper.kt @@ -43,7 +43,7 @@ import java.lang.reflect.Member import java.lang.reflect.Method import kotlin.reflect.KotlinReflectionInternalError -sealed class JvmFunctionSignature { +internal sealed class JvmFunctionSignature { abstract fun asString(): String class KotlinFunction( @@ -80,7 +80,7 @@ sealed class JvmFunctionSignature { } } -sealed class JvmPropertySignature { +internal sealed class JvmPropertySignature { /** * Returns the JVM signature of the getter of this property. In case the property doesn't have a getter, * constructs the signature of its imaginary default getter. See CallableReference#getSignature for more information @@ -116,7 +116,7 @@ sealed class JvmPropertySignature { } } -object RuntimeTypeMapper { +internal object RuntimeTypeMapper { fun mapSignature(possiblySubstitutedFunction: FunctionDescriptor): JvmFunctionSignature { // Fake overrides don't have a source element, so we need to take a declaration. // TODO: support the case when a fake override overrides several declarations with different signatures diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/foreignKClasses.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/foreignKClasses.kt index c3aff97f77b..af346803ba0 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/foreignKClasses.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/foreignKClasses.kt @@ -27,7 +27,7 @@ import kotlin.reflect.jvm.internal.pcollections.HashPMap private var FOREIGN_K_CLASSES = HashPMap.empty() // This function is invoked on each reflection access to Java classes, properties, etc. Performance is critical here. -fun foreignKotlinClass(jClass: Class): KClassImpl { +internal fun foreignKotlinClass(jClass: Class): KClassImpl { val name = jClass.getName() val cached = FOREIGN_K_CLASSES[name] if (cached is WeakReference<*>) {