From 8b93c665a3c2bfbca13f0ec694140147e61d3240 Mon Sep 17 00:00:00 2001 From: Niek Haarman Date: Thu, 4 Feb 2016 19:39:08 +0100 Subject: [PATCH] Update Kotlin to rc-1036 --- mockito-kotlin/build.gradle | 8 ++++---- .../com/nhaarman/mockito_kotlin/CreateInstance.kt | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mockito-kotlin/build.gradle b/mockito-kotlin/build.gradle index 1b28258c..fab1042e 100644 --- a/mockito-kotlin/build.gradle +++ b/mockito-kotlin/build.gradle @@ -6,7 +6,7 @@ buildscript { } dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.0-beta-4589" + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.0-rc-1036" } } @@ -16,13 +16,13 @@ repositories { } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:1.0.0-beta-4589" - compile "org.jetbrains.kotlin:kotlin-reflect:1.0.0-beta-4589" + compile "org.jetbrains.kotlin:kotlin-stdlib:1.0.0-rc-1036" + compile "org.jetbrains.kotlin:kotlin-reflect:1.0.0-rc-1036" compile "org.mockito:mockito-core:2.0.39-beta" /* Tests */ testCompile "junit:junit:4.12" - testCompile "com.nhaarman:expect.kt:0.3.0" + testCompile "com.nhaarman:expect.kt:0.4.0" } publishing { diff --git a/mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/CreateInstance.kt b/mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/CreateInstance.kt index 58c234ad..3815da89 100644 --- a/mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/CreateInstance.kt +++ b/mockito-kotlin/src/main/kotlin/com/nhaarman/mockito_kotlin/CreateInstance.kt @@ -76,7 +76,7 @@ private fun KClass<*>.isPrimitive() = "String" ) -@Suppress("UNCHECKED_CAST", "IMPLICIT_CAST_TO_UNIT_OR_ANY") +@Suppress("UNCHECKED_CAST", "IMPLICIT_CAST_TO_ANY") private fun KClass.toDefaultPrimitiveValue(): T { return when (simpleName) { "Boolean" -> true @@ -91,7 +91,7 @@ private fun KClass.toDefaultPrimitiveValue(): T { } as T } -@Suppress("UNCHECKED_CAST", "IMPLICIT_CAST_TO_UNIT_OR_ANY") +@Suppress("UNCHECKED_CAST", "IMPLICIT_CAST_TO_ANY") private fun KClass.toArrayInstance(): T { return when (simpleName) { "ByteArray" -> byteArrayOf() @@ -106,7 +106,7 @@ private fun KClass.toArrayInstance(): T { private fun KFunction.newInstance(): T { isAccessible = true - return callBy(parameters.toMap { + return callBy(parameters.associate { it to it.type.createNullableInstance() }) } @@ -130,7 +130,7 @@ private fun KType.createNullableInstance(): T? { */ @Suppress("UNCHECKED_CAST") private fun Class.uncheckedMock(): T { - val impl = MockSettingsImpl().defaultAnswer(Answers.RETURNS_DEFAULTS) as MockSettingsImpl<*> + val impl = MockSettingsImpl().defaultAnswer(Answers.RETURNS_DEFAULTS) as MockSettingsImpl val creationSettings = impl.confirm(this) - return MockUtil().createMock(creationSettings) as T + return MockUtil().createMock(creationSettings) }