Skip to content

Commit 6aaafb4

Browse files
committed
update Kotlin to 2.3 and use qualified name over simple name for injectables (#175)
1 parent 1ef6ab9 commit 6aaafb4

File tree

6 files changed

+6
-11
lines changed

6 files changed

+6
-11
lines changed

ReadMe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![LTS](https://img.shields.io/badge/LTS-2.12-orange.svg)](https://search.maven.org/artifact/io.github.quillraven.fleks/Fleks/2.12/jar)
66
[![Snapshot](https://img.shields.io/badge/Snapshot-2.13--SNAPSHOT-orange.svg)](https://central.sonatype.com/service/rest/repository/browse/maven-snapshots)
77
[![Build Master](https://img.shields.io/github/actions/workflow/status/quillraven/fleks/build.yml?branch=master)](https://github.com/Quillraven/fleks/actions)
8-
[![Kotlin](https://img.shields.io/badge/Kotlin-2.2.10-red.svg)](http://kotlinlang.org/)
8+
[![Kotlin](https://img.shields.io/badge/Kotlin-2.3.0-red.svg)](http://kotlinlang.org/)
99

1010
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/Quillraven/Fleks/blob/master/LICENSE)
1111

buildSrc/src/main/kotlin/buildsrc/plugins/kmp-js.gradle.kts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ plugins {
1010
}
1111

1212
kotlin {
13-
js(IR) {
14-
browser()
15-
nodejs()
16-
}
17-
1813
@OptIn(ExperimentalWasmDsl::class)
1914
wasmJs {
2015
browser()

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
22

3-
kotlin = "2.2.21"
3+
kotlin = "2.3.0"
44
kotlinxSerialization = "1.9.0"
55
kotlinDokka = "2.1.0"
66
kotlinxBenchmark = "0.4.14"

src/commonMain/kotlin/com/github/quillraven/fleks/world.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class World internal constructor(
113113
*
114114
* @throws FleksNoSuchInjectableException if there is no injectable registered for [name].
115115
*/
116-
inline fun <reified T> inject(name: String = T::class.simpleName ?: T::class.toString()): T {
116+
inline fun <reified T> inject(name: String = T::class.qualifiedName ?: T::class.toString()): T {
117117
val injectable = injectables[name] ?: throw FleksNoSuchInjectableException(name)
118118
injectable.used = true
119119
return injectable.injObj as T
@@ -541,7 +541,7 @@ class World internal constructor(
541541
* @throws FleksNoSuchInjectableException if there is no injectable registered for [name].
542542
* @throws FleksWrongConfigurationUsageException if called outside a [WorldConfiguration] scope.
543543
*/
544-
inline fun <reified T> inject(name: String = T::class.simpleName ?: T::class.toString()): T =
544+
inline fun <reified T> inject(name: String = T::class.qualifiedName ?: T::class.toString()): T =
545545
CURRENT_WORLD?.inject(name) ?: throw FleksWrongConfigurationUsageException()
546546

547547
/**

src/commonMain/kotlin/com/github/quillraven/fleks/worldCfg.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class InjectableConfiguration(private val world: World) {
4141
*
4242
* @throws [FleksInjectableAlreadyAddedException] if the dependency was already added before.
4343
*/
44-
inline fun <reified T : Any> add(dependency: T) = add(T::class.simpleName ?: T::class.toString(), dependency)
44+
inline fun <reified T : Any> add(dependency: T) = add(T::class.qualifiedName ?: T::class.toString(), dependency)
4545
}
4646

4747
/**

src/commonTest/kotlin/com/github/quillraven/fleks/WorldTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ internal class WorldTest {
390390
add("used")
391391
}
392392
}
393-
val expected = mapOf("42" to "myString", "Int" to 1337)
393+
val expected = mapOf("42" to "myString", "kotlin.Int" to 1337)
394394
// this sets the 'used' string injectable to used=true
395395
world.inject<String>()
396396

0 commit comments

Comments
 (0)