Fixes after review

This commit is contained in:
Ilya Chernikov
2018-05-28 15:55:33 +02:00
parent 6218b2bcf6
commit 6fdb8746de
13 changed files with 63 additions and 68 deletions
@@ -8,13 +8,27 @@ package kotlin.script.experimental.api
import kotlin.reflect.KClass
import kotlin.reflect.KType
class KotlinType(
/**
* A Kotlin type representation for using in the scripting API
*/
class KotlinType private constructor(
val typeName: String,
val fromClass: KClass<*>? = null
val fromClass: KClass<*>?
// TODO: copy properties from KType
) {
// TODO: implement other approach for non-class types
constructor(type: KType) : this((type.classifier as KClass<*>).qualifiedName!!, type.classifier as KClass<*>)
/**
* Constructs KotlinType from fully-qualified [qualifiedTypeName] in a dot-separated form, e.g. "org.acme.Outer.Inner"
*/
constructor(qualifiedTypeName: String) : this(qualifiedTypeName, null)
/**
* Constructs KotlinType from reflected [kclass]
*/
constructor(kclass: KClass<*>) : this(kclass.qualifiedName!!, kclass)
// TODO: implement other approach for non-class types
/**
* Constructs KotlinType from reflected [ktype]
*/
constructor(type: KType) : this(type.classifier as KClass<*>)
}