@@ -226,12 +226,12 @@ object TypeUtil {
226
226
227
227
internal fun isKotlinBasicType (typeName : String ): Boolean {
228
228
val bareTypeName = getBareType(typeName)
229
- return kotlinBasicTypes .any { it == bareTypeName }
229
+ return kotlinBasicTypeNames .any { it == bareTypeName }
230
230
}
231
231
232
232
internal fun isKotlinCollectionTypes (typeName : String ): Boolean {
233
233
val bareTypeName = getBareType(typeName)
234
- return kotlinCollectionTypes .any { it == bareTypeName }
234
+ return kotlinCollectionTypeNames .any { it == bareTypeName }
235
235
}
236
236
237
237
internal fun getBareType (name : String ): String =
@@ -271,60 +271,63 @@ object TypeUtil {
271
271
this
272
272
}
273
273
274
- // Basic types in Kotlin are described here: https://kotlinlang.org/docs/basic-types.html
275
- private val kotlinBasicTypes: Set <String >
276
- get() =
277
- setOf (
278
- " Byte" ,
279
- " Short" ,
280
- " Int" ,
281
- " Long" ,
282
- " Float" ,
283
- " Double" ,
284
- " UByte" ,
285
- " UShort" ,
286
- " UInt" ,
287
- " ULong" ,
288
- " UByteArray" ,
289
- " UShortArray" ,
290
- " UIntArray" ,
291
- " ULongArray" ,
292
- " Boolean" ,
293
- " Char" ,
294
- " String" ,
295
- " Unit" ,
296
- " Any" ,
297
- " Nothing" ,
298
- )
274
+ // Kotlin basic types: https://kotlinlang.org/docs/basic-types.html
275
+ @OptIn(ExperimentalUnsignedTypes ::class )
276
+ private val kotlinBasicTypeNames: Set <String > =
277
+ setOf (
278
+ Any ::class ,
279
+ Boolean ::class ,
280
+ Byte ::class ,
281
+ Char ::class ,
282
+ Double ::class ,
283
+ Float ::class ,
284
+ Int ::class ,
285
+ Long ::class ,
286
+ Nothing ::class ,
287
+ Number ::class ,
288
+ Short ::class ,
289
+ String ::class ,
290
+ UByte ::class ,
291
+ UByteArray ::class ,
292
+ UInt ::class ,
293
+ UIntArray ::class ,
294
+ ULong ::class ,
295
+ ULongArray ::class ,
296
+ UShort ::class ,
297
+ UShortArray ::class ,
298
+ Unit ::class ,
299
+ ).mapNotNull { it.simpleName }
300
+ .toSet()
299
301
300
- // Collections in Kotlin are described here: https://kotlinlang.org/docs/collections-overview.html#collection
301
- // and here https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections
302
- private val kotlinCollectionTypes: Set <String >
303
- get() =
304
- setOf (
305
- " AbstractCollection" ,
306
- " AbstractIterator" ,
307
- " AbstractList" ,
308
- " AbstractMap" ,
309
- " AbstractMutableCollection" ,
310
- " AbstractMutableList" ,
311
- " AbstractMutableMap" ,
312
- " AbstractMutableSet" ,
313
- " AbstractSet" ,
314
- " ArrayDeque" ,
315
- " ArrayList" ,
316
- " Array" ,
317
- " Collection" ,
318
- " HashMap" ,
319
- " HashSet" ,
320
- " LinkedHashMap" ,
321
- " LinkedHashSet" ,
322
- " List" ,
323
- " Map" ,
324
- " MutableCollection" ,
325
- " MutableList" ,
326
- " MutableMap" ,
327
- " MutableSet" ,
328
- " Set" ,
329
- )
302
+ // Kotlin collections types:
303
+ // https://kotlinlang.org/docs/collections-overview.html#collection
304
+ // https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections
305
+ private val kotlinCollectionTypeNames: Set <String > =
306
+ setOf (
307
+ AbstractCollection ::class ,
308
+ AbstractIterator ::class ,
309
+ AbstractList ::class ,
310
+ AbstractMap ::class ,
311
+ AbstractMutableCollection ::class ,
312
+ AbstractMutableList ::class ,
313
+ AbstractMutableMap ::class ,
314
+ AbstractMutableSet ::class ,
315
+ AbstractSet ::class ,
316
+ ArrayDeque ::class ,
317
+ ArrayList ::class ,
318
+ Array ::class ,
319
+ Collection ::class ,
320
+ HashMap ::class ,
321
+ HashSet ::class ,
322
+ LinkedHashMap ::class ,
323
+ LinkedHashSet ::class ,
324
+ List ::class ,
325
+ Map ::class ,
326
+ MutableCollection ::class ,
327
+ MutableList ::class ,
328
+ MutableMap ::class ,
329
+ MutableSet ::class ,
330
+ Set ::class ,
331
+ ).mapNotNull { it.simpleName }
332
+ .toSet()
330
333
}
0 commit comments