Optimistically add isInstance and qualifiedName to common KClass

Because they are used in common cast and safeCast functions
This commit is contained in:
Ilya Gorbunov
2019-12-17 19:01:18 +03:00
parent 47f78c424d
commit ea95aabbb0
2 changed files with 15 additions and 2 deletions
@@ -24,7 +24,7 @@ public actual interface KClass<T : Any> : KDeclarationContainer, KAnnotatedEleme
* The fully qualified dot-separated name of the class, * The fully qualified dot-separated name of the class,
* or `null` if the class is local or it is an anonymous object literal. * or `null` if the class is local or it is an anonymous object literal.
*/ */
public val qualifiedName: String? public actual val qualifiedName: String?
/** /**
* All functions and properties accessible in this class, including those declared in this class * All functions and properties accessible in this class, including those declared in this class
@@ -51,7 +51,7 @@ public actual interface KClass<T : Any> : KDeclarationContainer, KAnnotatedEleme
* Returns `true` if [value] is an instance of this class on a given platform. * Returns `true` if [value] is an instance of this class on a given platform.
*/ */
@SinceKotlin("1.1") @SinceKotlin("1.1")
public fun isInstance(value: Any?): Boolean public actual fun isInstance(value: Any?): Boolean
/** /**
* The list of type parameters of this class. This list does *not* include type parameters of outer classes. * The list of type parameters of this class. This list does *not* include type parameters of outer classes.
@@ -19,4 +19,17 @@ public expect interface KClass<T : Any> {
* or `null` if the class has no name (if, for example, it is an anonymous object literal). * or `null` if the class has no name (if, for example, it is an anonymous object literal).
*/ */
public val simpleName: String? public val simpleName: String?
/**
* The fully qualified dot-separated name of the class,
* or `null` if the class is local or it is an anonymous object literal.
*/
public val qualifiedName: String?
/**
* Returns `true` if [value] is an instance of this class on a given platform.
*/
@SinceKotlin("1.1")
public fun isInstance(value: Any?): Boolean
} }