File tree Expand file tree Collapse file tree 3 files changed +4
-20
lines changed
core/reflection.jvm/src/kotlin/reflect/jvm/internal/calls Expand file tree Collapse file tree 3 files changed +4
-20
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ private fun Any?.transformKotlinToJvm(expectedType: Class<*>): Any? {
72
72
is KClass <* > -> this .java
73
73
is Array <* > -> when {
74
74
this .isArrayOf<Class <* >>() -> return null
75
- this .isArrayOf<KClass <* >>() -> this .map(KClass <* >::java).toTypedArray()
75
+ this .isArrayOf<KClass <* >>() -> ( this as Array < KClass < * >>) .map(KClass <* >::java).toTypedArray()
76
76
else -> this
77
77
}
78
78
else -> this
Original file line number Diff line number Diff line change 7
7
8
8
package kotlin.jvm
9
9
10
- import kotlin.contracts.contract
11
10
import kotlin.internal.InlineOnly
12
11
import kotlin.jvm.internal.ClassBasedDeclarationContainer
13
12
import kotlin.jvm.internal.Reflection
@@ -96,15 +95,11 @@ public inline val <T : Any> KClass<T>.javaClass: Class<KClass<T>>
96
95
get() = (this as java.lang.Object ).getClass() as Class <KClass <T >>
97
96
98
97
/* *
99
- * Checks if the array can contain an element of type [T].
98
+ * Checks if array can contain element of type [T].
100
99
*/
101
100
@Suppress(" REIFIED_TYPE_PARAMETER_NO_INLINE" )
102
- public fun <reified T : Any > Array <* >.isArrayOf (): Boolean {
103
- contract {
104
- returns(true ) implies (this @isArrayOf is Array <T >)
105
- }
106
- return T ::class .java.isAssignableFrom(this ::class .java.componentType)
107
- }
101
+ public fun <reified T : Any > Array <* >.isArrayOf (): Boolean =
102
+ T ::class .java.isAssignableFrom(this ::class .java.componentType)
108
103
109
104
/* *
110
105
* Returns a [KClass] instance corresponding to the annotation type of this annotation.
Original file line number Diff line number Diff line change @@ -124,17 +124,6 @@ class CollectionJVMTest {
124
124
}
125
125
}
126
126
127
- @Test fun isArrayOf () {
128
- val arr: Array <* > = arrayOf(" smart" )
129
-
130
- if (arr.isArrayOf<String >()) {
131
- val str: String = arr[0 ]
132
- assertEquals(" smart" , str)
133
- } else {
134
- fail(" Should not be reachable" )
135
- }
136
- }
137
-
138
127
@Test fun toSortedSet () {
139
128
val data = listOf (" foo" , " Foo" , " bar" )
140
129
val set1 = data.toSortedSet()
You can’t perform that action at this time.
0 commit comments