kotlin-test: Remove javaClass as is in runtime now
This commit is contained in:
@@ -23,8 +23,7 @@ internal fun lookup(): Asserter {
|
||||
|
||||
private fun initContributors() {
|
||||
contributors.clear()
|
||||
@Suppress("DEPRECATION")
|
||||
val loader = ServiceLoader.load(AsserterContributor::class.javaClass)
|
||||
val loader = ServiceLoader.load(AsserterContributor::class.java)
|
||||
|
||||
for (contributor in loader) {
|
||||
if (contributor != null) {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
@file:kotlin.jvm.JvmName("TestAssertionsKt")
|
||||
package kotlin.test
|
||||
|
||||
import kotlin.jvm.internal.*
|
||||
import kotlin.reflect.*
|
||||
|
||||
@Deprecated("Use assertFailsWith instead.", ReplaceWith("assertFailsWith(exceptionClass, block)"), kotlin.DeprecationLevel.ERROR)
|
||||
@@ -34,14 +33,12 @@ fun <T : Throwable> assertFailsWith(exceptionClass: Class<T>, message: String?,
|
||||
fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, block: () -> Unit): T = assertFailsWith(exceptionClass, null, block)
|
||||
|
||||
/** Asserts that a [block] fails with a specific exception of type [exceptionClass] being thrown. */
|
||||
@Suppress("DEPRECATION")
|
||||
fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, message: String?, block: () -> Unit): T = assertFailsWith(exceptionClass.javaClass, message, block)
|
||||
fun <T : Throwable> assertFailsWith(exceptionClass: KClass<T>, message: String?, block: () -> Unit): T = assertFailsWith(exceptionClass.java, message, block)
|
||||
|
||||
/** Asserts that a [block] fails with a specific exception of type [T] being thrown.
|
||||
* Since inline method doesn't allow to trace where it was invoked, it is required to pass a [message] to distinguish this method call from others.
|
||||
*/
|
||||
@Suppress("DEPRECATION")
|
||||
inline fun <reified T : Throwable> assertFailsWith(message: String, noinline block: () -> Unit): T = assertFailsWith(T::class.javaClass, message, block)
|
||||
inline fun <reified T : Throwable> assertFailsWith(message: String, noinline block: () -> Unit): T = assertFailsWith(T::class.java, message, block)
|
||||
|
||||
|
||||
/**
|
||||
@@ -62,12 +59,3 @@ inline fun currentStackTrace() = (java.lang.Exception() as java.lang.Throwable).
|
||||
val asserter: Asserter
|
||||
get() = lookup()
|
||||
|
||||
|
||||
/**
|
||||
* Returns a Java [Class] instance corresponding to the given [KClass] instance.
|
||||
*/
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@Intrinsic("kotlin.KClass.java.property")
|
||||
@Deprecated("This is for internal use only", ReplaceWith("this.java"), kotlin.DeprecationLevel.WARNING)
|
||||
val <T : Any> KClass<T>.javaClass: Class<T>
|
||||
get() = (this as ClassBasedDeclarationContainer).jClass as Class<T>
|
||||
|
||||
Reference in New Issue
Block a user