explicit internal modifier for some members of core/reflection.jvm in order to avoid generating documentaion

This commit is contained in:
Michael Nedzelsky
2015-09-03 19:41:09 +03:00
parent d9bbc88112
commit 5e35161d99
17 changed files with 30 additions and 30 deletions
@@ -21,7 +21,7 @@ import java.lang.reflect.Field
import kotlin.reflect.jvm.internal.JvmPropertySignature.JavaField import kotlin.reflect.jvm.internal.JvmPropertySignature.JavaField
import kotlin.reflect.jvm.internal.JvmPropertySignature.KotlinProperty import kotlin.reflect.jvm.internal.JvmPropertySignature.KotlinProperty
abstract class DescriptorBasedProperty<out R> protected constructor( internal abstract class DescriptorBasedProperty<out R> protected constructor(
internal val container: KDeclarationContainerImpl, internal val container: KDeclarationContainerImpl,
name: String, name: String,
signature: String, signature: String,
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotated
import org.jetbrains.kotlin.load.kotlin.reflect.ReflectAnnotationSource import org.jetbrains.kotlin.load.kotlin.reflect.ReflectAnnotationSource
import kotlin.reflect.KAnnotatedElement import kotlin.reflect.KAnnotatedElement
interface KAnnotatedElementImpl : KAnnotatedElement { internal interface KAnnotatedElementImpl : KAnnotatedElement {
val annotated: Annotated val annotated: Annotated
override val annotations: List<Annotation> override val annotations: List<Annotation>
@@ -26,7 +26,7 @@ import kotlin.reflect.KType
import kotlin.reflect.KotlinReflectionInternalError import kotlin.reflect.KotlinReflectionInternalError
import kotlin.reflect.jvm.javaType import kotlin.reflect.jvm.javaType
interface KCallableImpl<out R> : KCallable<R>, KAnnotatedElementImpl { internal interface KCallableImpl<out R> : KCallable<R>, KAnnotatedElementImpl {
val descriptor: CallableMemberDescriptor val descriptor: CallableMemberDescriptor
val caller: FunctionCaller<*> val caller: FunctionCaller<*>
@@ -37,7 +37,7 @@ import kotlin.reflect.KClass
import kotlin.reflect.KFunction import kotlin.reflect.KFunction
import kotlin.reflect.KotlinReflectionInternalError import kotlin.reflect.KotlinReflectionInternalError
class KClassImpl<T : Any>(override val jClass: Class<T>) : KDeclarationContainerImpl(), KClass<T>, KAnnotatedElementImpl { internal class KClassImpl<T : Any>(override val jClass: Class<T>) : KDeclarationContainerImpl(), KClass<T>, KAnnotatedElementImpl {
val descriptor by ReflectProperties.lazySoft { val descriptor by ReflectProperties.lazySoft {
val classId = classId val classId = classId
@@ -36,7 +36,7 @@ import kotlin.jvm.internal.ClassBasedDeclarationContainer
import kotlin.reflect.KCallable import kotlin.reflect.KCallable
import kotlin.reflect.KotlinReflectionInternalError 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 // 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 { val moduleData by ReflectProperties.lazySoft {
jClass.getOrCreateModule() jClass.getOrCreateModule()
@@ -24,7 +24,7 @@ import kotlin.jvm.internal.FunctionReference
import kotlin.reflect.KCallable import kotlin.reflect.KCallable
import kotlin.reflect.KotlinReflectionInternalError import kotlin.reflect.KotlinReflectionInternalError
class KFunctionFromReferenceImpl( internal class KFunctionFromReferenceImpl(
val reference: FunctionReference val reference: FunctionReference
): KFunctionImpl( ): KFunctionImpl(
reference.getOwner() as? KDeclarationContainerImpl ?: EmptyContainerForLocal, 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) 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<*> override val jClass: Class<*>
get() = fail() get() = fail()
@@ -30,7 +30,7 @@ import kotlin.reflect.jvm.internal.JvmFunctionSignature.JavaConstructor
import kotlin.reflect.jvm.internal.JvmFunctionSignature.JavaMethod import kotlin.reflect.jvm.internal.JvmFunctionSignature.JavaMethod
import kotlin.reflect.jvm.internal.JvmFunctionSignature.KotlinFunction import kotlin.reflect.jvm.internal.JvmFunctionSignature.KotlinFunction
open class KFunctionImpl protected constructor( internal open class KFunctionImpl protected constructor(
private val container: KDeclarationContainerImpl, private val container: KDeclarationContainerImpl,
name: String, name: String,
signature: String, signature: String,
@@ -27,7 +27,7 @@ import kotlin.jvm.internal.KotlinPackage
import kotlin.reflect.KCallable import kotlin.reflect.KCallable
import kotlin.reflect.KPackage 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 descriptor by ReflectProperties.lazySoft {
val moduleData = jClass.getOrCreateModule() val moduleData = jClass.getOrCreateModule()
moduleData.packageFacadeProvider.registerModule(moduleName) moduleData.packageFacadeProvider.registerModule(moduleName)
@@ -23,7 +23,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.hasDefaultValue
import kotlin.reflect.KParameter import kotlin.reflect.KParameter
import kotlin.reflect.KType import kotlin.reflect.KType
class KParameterImpl( internal class KParameterImpl(
val callable: KCallableImpl<*>, val callable: KCallableImpl<*>,
override val index: Int, override val index: Int,
override val kind: KParameter.Kind, override val kind: KParameter.Kind,
@@ -22,7 +22,7 @@ import kotlin.jvm.internal.PropertyReference0
import kotlin.reflect.KMutableProperty0 import kotlin.reflect.KMutableProperty0
import kotlin.reflect.KProperty0 import kotlin.reflect.KProperty0
open class KProperty0Impl<out R> : DescriptorBasedProperty<R>, KProperty0<R>, KPropertyImpl<R> { internal open class KProperty0Impl<out R> : DescriptorBasedProperty<R>, KProperty0<R>, KPropertyImpl<R> {
constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor)
constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature)
@@ -36,7 +36,7 @@ open class KProperty0Impl<out R> : DescriptorBasedProperty<R>, KProperty0<R>, KP
} }
} }
open class KMutableProperty0Impl<R> : KProperty0Impl<R>, KMutableProperty0<R>, KMutablePropertyImpl<R> { internal open class KMutableProperty0Impl<R> : KProperty0Impl<R>, KMutableProperty0<R>, KMutablePropertyImpl<R> {
constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor)
constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature)
@@ -51,7 +51,7 @@ open class KMutableProperty0Impl<R> : KProperty0Impl<R>, KMutableProperty0<R>, K
} }
class KProperty0FromReferenceImpl( internal class KProperty0FromReferenceImpl(
val reference: PropertyReference0 val reference: PropertyReference0
) : KProperty0Impl<Any?>( ) : KProperty0Impl<Any?>(
reference.owner as KDeclarationContainerImpl, reference.owner as KDeclarationContainerImpl,
@@ -64,7 +64,7 @@ class KProperty0FromReferenceImpl(
} }
class KMutableProperty0FromReferenceImpl( internal class KMutableProperty0FromReferenceImpl(
val reference: MutablePropertyReference0 val reference: MutablePropertyReference0
) : KMutableProperty0Impl<Any?>( ) : KMutableProperty0Impl<Any?>(
reference.owner as KDeclarationContainerImpl, reference.owner as KDeclarationContainerImpl,
@@ -22,7 +22,7 @@ import kotlin.jvm.internal.PropertyReference1
import kotlin.reflect.KMutableProperty1 import kotlin.reflect.KMutableProperty1
import kotlin.reflect.KProperty1 import kotlin.reflect.KProperty1
open class KProperty1Impl<T, out R> : DescriptorBasedProperty<R>, KProperty1<T, R>, KPropertyImpl<R> { internal open class KProperty1Impl<T, out R> : DescriptorBasedProperty<R>, KProperty1<T, R>, KPropertyImpl<R> {
constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature)
constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor)
@@ -36,7 +36,7 @@ open class KProperty1Impl<T, out R> : DescriptorBasedProperty<R>, KProperty1<T,
} }
} }
open class KMutableProperty1Impl<T, R> : KProperty1Impl<T, R>, KMutableProperty1<T, R>, KMutablePropertyImpl<R> { internal open class KMutableProperty1Impl<T, R> : KProperty1Impl<T, R>, KMutableProperty1<T, R>, KMutablePropertyImpl<R> {
constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature)
constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor)
@@ -51,7 +51,7 @@ open class KMutableProperty1Impl<T, R> : KProperty1Impl<T, R>, KMutableProperty1
} }
class KProperty1FromReferenceImpl( internal class KProperty1FromReferenceImpl(
val reference: PropertyReference1 val reference: PropertyReference1
) : KProperty1Impl<Any?, Any?>( ) : KProperty1Impl<Any?, Any?>(
reference.owner as KDeclarationContainerImpl, reference.owner as KDeclarationContainerImpl,
@@ -64,7 +64,7 @@ class KProperty1FromReferenceImpl(
} }
class KMutableProperty1FromReferenceImpl( internal class KMutableProperty1FromReferenceImpl(
val reference: MutablePropertyReference1 val reference: MutablePropertyReference1
) : KMutableProperty1Impl<Any?, Any?>( ) : KMutableProperty1Impl<Any?, Any?>(
reference.owner as KDeclarationContainerImpl, reference.owner as KDeclarationContainerImpl,
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.descriptors.PropertyDescriptor
import kotlin.reflect.KMutableProperty2 import kotlin.reflect.KMutableProperty2
import kotlin.reflect.KProperty2 import kotlin.reflect.KProperty2
open class KProperty2Impl<D, E, out R> : DescriptorBasedProperty<R>, KProperty2<D, E, R>, KPropertyImpl<R> { internal open class KProperty2Impl<D, E, out R> : DescriptorBasedProperty<R>, KProperty2<D, E, R>, KPropertyImpl<R> {
constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature)
constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor)
@@ -34,7 +34,7 @@ open class KProperty2Impl<D, E, out R> : DescriptorBasedProperty<R>, KProperty2<
} }
} }
class KMutableProperty2Impl<D, E, R> : KProperty2Impl<D, E, R>, KMutableProperty2<D, E, R>, KMutablePropertyImpl<R> { internal class KMutableProperty2Impl<D, E, R> : KProperty2Impl<D, E, R>, KMutableProperty2<D, E, R>, KMutablePropertyImpl<R> {
constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature) constructor(container: KDeclarationContainerImpl, name: String, signature: String) : super(container, name, signature)
constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor) constructor(container: KDeclarationContainerImpl, descriptor: PropertyDescriptor) : super(container, descriptor)
@@ -25,10 +25,10 @@ import java.lang.reflect.Modifier
import kotlin.reflect.KMutableProperty import kotlin.reflect.KMutableProperty
import kotlin.reflect.KProperty import kotlin.reflect.KProperty
interface KPropertyImpl<out R> : KProperty<R>, KCallableImpl<R> { internal interface KPropertyImpl<out R> : KProperty<R>, KCallableImpl<R> {
val javaField: Field? internal val javaField: Field?
val container: KDeclarationContainerImpl internal val container: KDeclarationContainerImpl
override val getter: Getter<R> override val getter: Getter<R>
@@ -63,7 +63,7 @@ interface KPropertyImpl<out R> : KProperty<R>, KCallableImpl<R> {
} }
interface KMutablePropertyImpl<R> : KMutableProperty<R>, KPropertyImpl<R> { internal interface KMutablePropertyImpl<R> : KMutableProperty<R>, KPropertyImpl<R> {
override val setter: Setter<R> override val setter: Setter<R>
abstract class Setter<R> : KPropertyImpl.Accessor<R>(), KMutableProperty.Setter<R>, KCallableImpl<Unit> { abstract class Setter<R> : KPropertyImpl.Accessor<R>(), KMutableProperty.Setter<R>, KCallableImpl<Unit> {
@@ -20,7 +20,7 @@ import org.jetbrains.kotlin.types.JetType
import java.lang.reflect.Type import java.lang.reflect.Type
import kotlin.reflect.KType import kotlin.reflect.KType
class KTypeImpl( internal class KTypeImpl(
val type: JetType, val type: JetType,
computeJavaType: () -> Type computeJavaType: () -> Type
) : KType { ) : KType {
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.renderer.DescriptorRenderer
import org.jetbrains.kotlin.types.JetType import org.jetbrains.kotlin.types.JetType
import kotlin.reflect.KParameter import kotlin.reflect.KParameter
object ReflectionObjectRenderer { internal object ReflectionObjectRenderer {
private val renderer = DescriptorRenderer.FQ_NAMES_IN_TYPES private val renderer = DescriptorRenderer.FQ_NAMES_IN_TYPES
private fun StringBuilder.appendReceiverType(receiver: ReceiverParameterDescriptor?) { private fun StringBuilder.appendReceiverType(receiver: ReceiverParameterDescriptor?) {
@@ -43,7 +43,7 @@ import java.lang.reflect.Member
import java.lang.reflect.Method import java.lang.reflect.Method
import kotlin.reflect.KotlinReflectionInternalError import kotlin.reflect.KotlinReflectionInternalError
sealed class JvmFunctionSignature { internal sealed class JvmFunctionSignature {
abstract fun asString(): String abstract fun asString(): String
class KotlinFunction( 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, * 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 * 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 { fun mapSignature(possiblySubstitutedFunction: FunctionDescriptor): JvmFunctionSignature {
// Fake overrides don't have a source element, so we need to take a declaration. // 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 // TODO: support the case when a fake override overrides several declarations with different signatures
@@ -27,7 +27,7 @@ import kotlin.reflect.jvm.internal.pcollections.HashPMap
private var FOREIGN_K_CLASSES = HashPMap.empty<String, Any>() private var FOREIGN_K_CLASSES = HashPMap.empty<String, Any>()
// This function is invoked on each reflection access to Java classes, properties, etc. Performance is critical here. // This function is invoked on each reflection access to Java classes, properties, etc. Performance is critical here.
fun <T : Any> foreignKotlinClass(jClass: Class<T>): KClassImpl<T> { internal fun <T : Any> foreignKotlinClass(jClass: Class<T>): KClassImpl<T> {
val name = jClass.getName() val name = jClass.getName()
val cached = FOREIGN_K_CLASSES[name] val cached = FOREIGN_K_CLASSES[name]
if (cached is WeakReference<*>) { if (cached is WeakReference<*>) {