Move .java and .kotlin extension properties to kotlin.jvm

Delete the old ones in package kotlin.reflect.jvm because otherwise the code
using those functions will become red in a lot less meaningful way (overload
resolution ambiguity) than if they're deleted (unresolved import)

Based on the work originally done by @dnpetrov

 #KT-8380 Fixed
This commit is contained in:
Alexander Udalov
2015-08-26 16:21:47 +03:00
parent b8badd59ba
commit 8d9618348d
32 changed files with 155 additions and 50 deletions
@@ -45,3 +45,14 @@ public val <T> KClass<T>.declaredExtensionProperties: Collection<KProperty2<T, *
public var KProperty<*>.accessible: Boolean
get() = isAccessible
set(value) { isAccessible = value }
@deprecated("Use .java instead.", ReplaceWith("java"))
public val <T> KClass<T>.__java: Class<T>
@jvmName("getJava")
get() = this.java
@deprecated("Use .kotlin instead.", ReplaceWith("kotlin"))
public val <T> Class<T>.__kotlin: KClass<T>
@jvmName("getKotlin")
get() = this.kotlin
@@ -17,19 +17,11 @@
package kotlin.reflect.jvm
import java.lang.reflect.*
import kotlin.jvm.internal.Intrinsic
import kotlin.reflect.*
import kotlin.reflect.jvm.internal.*
// Kotlin reflection -> Java reflection
/**
* Returns a Java [Class] instance corresponding to the given [KClass] instance.
*/
@Intrinsic("kotlin.KClass.java.property")
public val <T> KClass<T>.java: Class<T>
get() = (this as KClassImpl<T>).jClass
/**
* Returns a Java [Class] instance that represents a Kotlin package.
* The methods and fields of this class are generated from top level functions and properties in the Kotlin package.
@@ -90,13 +82,6 @@ public val KType.javaType: Type
// Java reflection -> Kotlin reflection
// TODO: getstatic $kotlinClass or go to foreignKClasses
/**
* Returns a [KClass] instance corresponding to the given Java [Class] instance.
*/
public val <T> Class<T>.kotlin: KClass<T>
get() = KClassImpl(this)
/**
* Returns a [KPackage] instance corresponding to the Java [Class] instance.
* The given class is generated from top level functions and properties in the Kotlin package.