Deprecate javaClass with replacement this::class.java.

Suppress deprecation in diagnostics tests.
This commit is contained in:
Ilya Gorbunov
2017-02-03 19:19:59 +03:00
parent d6a60424a9
commit b8de78dd43
3 changed files with 4 additions and 1 deletions
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -DEPRECATION
package test
class A {
@@ -1,3 +1,4 @@
// !DIAGNOSTICS: -DEPRECATION
// KT-9078 (NPE in control flow analysis); EA-71535
abstract class KFunctionKt9005WorkAround<out R: Any?>(private val _functionInstance: Function<R>) {
private val _reflectedFunction: kotlin.reflect.KFunction<R> = _functionInstance.<!UNRESOLVED_REFERENCE!>reflect<!>() ?: throw IllegalStateException("")
@@ -92,6 +92,7 @@ public val <T : Any> Class<T>.kotlin: KClass<T>
/**
* Returns the runtime Java class of this object.
*/
@Deprecated("Use 'instance::class.java' instead to get java class of the instance.", ReplaceWith("this::class.java"))
public val <T: Any> T.javaClass : Class<T>
@Suppress("UsePropertyAccessSyntax")
get() = (this as java.lang.Object).getClass() as Class<T>
@@ -107,7 +108,7 @@ public val <T: Any> KClass<T>.javaClass: Class<KClass<T>>
*/
@Suppress("REIFIED_TYPE_PARAMETER_NO_INLINE")
public fun <reified T : Any> Array<*>.isArrayOf(): Boolean =
T::class.java.isAssignableFrom(this.javaClass.componentType)
T::class.java.isAssignableFrom(this::class.java.componentType)
/**
* Returns a [KClass] instance corresponding to the annotation type of this annotation.