diff --git a/android/koin-android/src/main/java/org/koin/android/ext/koin/KoinExt.kt b/android/koin-android/src/main/java/org/koin/android/ext/koin/KoinExt.kt index 37e333168..40ef4d33c 100644 --- a/android/koin-android/src/main/java/org/koin/android/ext/koin/KoinExt.kt +++ b/android/koin-android/src/main/java/org/koin/android/ext/koin/KoinExt.kt @@ -14,6 +14,8 @@ * limitations under the License. */ +@file:OptIn(KoinInternalApi::class) + package org.koin.android.ext.koin import android.app.Application @@ -39,8 +41,6 @@ import java.util.* * Setup Android Logger for Koin * @param level */ -@OptIn(KoinInternalApi::class) - fun KoinApplication.androidLogger( level: Level = Level.INFO, ): KoinApplication { diff --git a/android/koin-android/src/main/java/org/koin/androidx/scope/LifecycleViewModelScopeDelegate.kt b/android/koin-android/src/main/java/org/koin/androidx/scope/LifecycleViewModelScopeDelegate.kt index 178faf830..689fee05c 100644 --- a/android/koin-android/src/main/java/org/koin/androidx/scope/LifecycleViewModelScopeDelegate.kt +++ b/android/koin-android/src/main/java/org/koin/androidx/scope/LifecycleViewModelScopeDelegate.kt @@ -6,12 +6,14 @@ import androidx.lifecycle.DefaultLifecycleObserver import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleOwner import org.koin.core.Koin +import org.koin.core.annotation.KoinInternalApi import org.koin.core.component.getScopeName import org.koin.core.scope.Scope import kotlin.properties.ReadOnlyProperty import kotlin.reflect.KProperty //TODO Deprecate +@OptIn(KoinInternalApi::class) class LifecycleViewModelScopeDelegate( private val lifecycleOwner: ComponentActivity, private val koin : Koin, diff --git a/android/koin-android/src/test/java/org/koin/test/android/AndroidModuleTest.kt b/android/koin-android/src/test/java/org/koin/test/android/AndroidModuleTest.kt index 99c12d1a6..ce918998b 100644 --- a/android/koin-android/src/test/java/org/koin/test/android/AndroidModuleTest.kt +++ b/android/koin-android/src/test/java/org/koin/test/android/AndroidModuleTest.kt @@ -7,7 +7,9 @@ import org.junit.Assert.assertTrue import org.junit.Test import org.koin.android.ext.koin.androidApplication import org.koin.android.ext.koin.androidContext +import org.koin.core.annotation.KoinInternalApi import org.koin.core.logger.EmptyLogger +import org.koin.core.logger.PrintLogger import org.koin.dsl.koinApplication import org.koin.dsl.module import org.koin.test.KoinTest @@ -16,6 +18,7 @@ import org.mockito.Mockito.mock /** * Android Module Tests */ +@OptIn(KoinInternalApi::class) class AndroidModuleTest : KoinTest { companion object { @@ -95,6 +98,6 @@ class AndroidModuleTest : KoinTest { modules(SampleModule) }.koin - assertTrue(koin.logger is EmptyLogger) + assertTrue(koin.logger is PrintLogger) } } \ No newline at end of file diff --git a/android/koin-android/src/test/java/org/koin/test/android/ext/koin/KoinExtTest.kt b/android/koin-android/src/test/java/org/koin/test/android/ext/koin/KoinExtTest.kt index 3c8ca309c..c8b1ecc31 100644 --- a/android/koin-android/src/test/java/org/koin/test/android/ext/koin/KoinExtTest.kt +++ b/android/koin-android/src/test/java/org/koin/test/android/ext/koin/KoinExtTest.kt @@ -18,6 +18,7 @@ import org.koin.core.logger.Logger import org.koin.core.logger.MESSAGE import org.koin.core.registry.saveProperties +@OptIn(KoinInternalApi::class) class KoinExtTest { @Test diff --git a/core/koin-core/src/commonMain/kotlin/org/koin/core/Koin.kt b/core/koin-core/src/commonMain/kotlin/org/koin/core/Koin.kt index 01a98bc01..dcf7efda7 100644 --- a/core/koin-core/src/commonMain/kotlin/org/koin/core/Koin.kt +++ b/core/koin-core/src/commonMain/kotlin/org/koin/core/Koin.kt @@ -22,7 +22,9 @@ import org.koin.core.component.getScopeName import org.koin.core.error.ScopeNotCreatedException import org.koin.core.extension.ExtensionManager import org.koin.core.logger.EmptyLogger +import org.koin.core.logger.Level import org.koin.core.logger.Logger +import org.koin.core.logger.PrintLogger import org.koin.core.module.Module import org.koin.core.module.flatten import org.koin.core.parameter.ParametersDefinition @@ -59,6 +61,7 @@ class Koin { @KoinInternalApi val extensionManager = ExtensionManager(this) + @KoinInternalApi var logger: Logger = EmptyLogger() private set diff --git a/core/koin-core/src/commonMain/kotlin/org/koin/core/logger/PrintLogger.kt b/core/koin-core/src/commonMain/kotlin/org/koin/core/logger/PrintLogger.kt new file mode 100644 index 000000000..de8f26ace --- /dev/null +++ b/core/koin-core/src/commonMain/kotlin/org/koin/core/logger/PrintLogger.kt @@ -0,0 +1,8 @@ +package org.koin.core.logger + +/** + * Multiplatform Basic Logger + * + * @author Arnaud Giuliani + */ +expect class PrintLogger(level: Level = Level.INFO) : Logger \ No newline at end of file diff --git a/core/koin-core/src/commonMain/kotlin/org/koin/core/registry/PropertyRegistry.kt b/core/koin-core/src/commonMain/kotlin/org/koin/core/registry/PropertyRegistry.kt index 5c4373080..43b9aeafd 100644 --- a/core/koin-core/src/commonMain/kotlin/org/koin/core/registry/PropertyRegistry.kt +++ b/core/koin-core/src/commonMain/kotlin/org/koin/core/registry/PropertyRegistry.kt @@ -16,6 +16,7 @@ package org.koin.core.registry import org.koin.core.Koin +import org.koin.core.annotation.KoinInternalApi import org.koin.mp.KoinPlatformTools /** @@ -24,6 +25,7 @@ import org.koin.mp.KoinPlatformTools * * @author Arnaud Giuliani */ +@OptIn(KoinInternalApi::class) @Suppress("UNCHECKED_CAST") class PropertyRegistry(internal val _koin: Koin) { diff --git a/core/koin-core/src/commonTest/kotlin/org/koin/dsl/KoinAppCreationTest.kt b/core/koin-core/src/commonTest/kotlin/org/koin/dsl/KoinAppCreationTest.kt index 30bb98dce..792648eb7 100644 --- a/core/koin-core/src/commonTest/kotlin/org/koin/dsl/KoinAppCreationTest.kt +++ b/core/koin-core/src/commonTest/kotlin/org/koin/dsl/KoinAppCreationTest.kt @@ -1,5 +1,6 @@ package org.koin.dsl +import org.koin.core.annotation.KoinInternalApi import org.koin.core.context.startKoin import org.koin.core.context.stopKoin import org.koin.core.error.KoinAppAlreadyStartedException @@ -12,6 +13,7 @@ import kotlin.test.Test import kotlin.test.assertEquals import kotlin.test.fail +@OptIn(KoinInternalApi::class) class KoinAppCreationTest { @AfterTest diff --git a/core/koin-core/src/jsMain/kotlin/org/koin/core/logger/PrintLogger.kt b/core/koin-core/src/jsMain/kotlin/org/koin/core/logger/PrintLogger.kt index ad2e0ea09..c5619235d 100644 --- a/core/koin-core/src/jsMain/kotlin/org/koin/core/logger/PrintLogger.kt +++ b/core/koin-core/src/jsMain/kotlin/org/koin/core/logger/PrintLogger.kt @@ -19,7 +19,7 @@ package org.koin.core.logger * Logger that print on system.out * @author - Arnaud GIULIANI */ -class PrintLogger(level: Level = Level.INFO) : Logger(level) { +actual class PrintLogger actual constructor(level: Level) : Logger(level) { override fun display(level: Level, msg: MESSAGE) { println("[$level] $KOIN_TAG $msg") diff --git a/core/koin-core/src/jvmMain/kotlin/org/koin/core/logger/PrintLogger.kt b/core/koin-core/src/jvmMain/kotlin/org/koin/core/logger/PrintLogger.kt index abf1f86a6..393f68f46 100644 --- a/core/koin-core/src/jvmMain/kotlin/org/koin/core/logger/PrintLogger.kt +++ b/core/koin-core/src/jvmMain/kotlin/org/koin/core/logger/PrintLogger.kt @@ -19,7 +19,7 @@ package org.koin.core.logger * Logger that print on system.out * @author - Arnaud GIULIANI */ -class PrintLogger(level: Level = Level.INFO) : Logger(level) { +actual class PrintLogger actual constructor(level: Level) : Logger(level) { private val printer = if (level >= Level.WARNING) System.err else System.out diff --git a/core/koin-core/src/jvmMain/kotlin/org/koin/core/registry/PropertyRegistryExt.kt b/core/koin-core/src/jvmMain/kotlin/org/koin/core/registry/PropertyRegistryExt.kt index 336b0eb89..16c3c997a 100644 --- a/core/koin-core/src/jvmMain/kotlin/org/koin/core/registry/PropertyRegistryExt.kt +++ b/core/koin-core/src/jvmMain/kotlin/org/koin/core/registry/PropertyRegistryExt.kt @@ -1,6 +1,9 @@ +@file:OptIn(KoinInternalApi::class) + package org.koin.core.registry import org.koin.core.Koin +import org.koin.core.annotation.KoinInternalApi import org.koin.core.error.NoPropertyFileFoundException import java.util.* diff --git a/core/koin-core/src/jvmTest/kotlin/org/koin/core/DebugLogTest.kt b/core/koin-core/src/jvmTest/kotlin/org/koin/core/DebugLogTest.kt index 37ed03575..3ccb14a5e 100644 --- a/core/koin-core/src/jvmTest/kotlin/org/koin/core/DebugLogTest.kt +++ b/core/koin-core/src/jvmTest/kotlin/org/koin/core/DebugLogTest.kt @@ -1,10 +1,12 @@ package org.koin.core import org.junit.Test +import org.koin.core.annotation.KoinInternalApi import org.koin.core.context.startKoin import org.koin.core.context.stopKoin import org.koin.core.logger.Level +@OptIn(KoinInternalApi::class) class DebugLogTest { @Test diff --git a/core/koin-core/src/nativeMain/kotlin/org/koin/core/logger/PrintLogger.kt b/core/koin-core/src/nativeMain/kotlin/org/koin/core/logger/PrintLogger.kt index ad2e0ea09..c5619235d 100644 --- a/core/koin-core/src/nativeMain/kotlin/org/koin/core/logger/PrintLogger.kt +++ b/core/koin-core/src/nativeMain/kotlin/org/koin/core/logger/PrintLogger.kt @@ -19,7 +19,7 @@ package org.koin.core.logger * Logger that print on system.out * @author - Arnaud GIULIANI */ -class PrintLogger(level: Level = Level.INFO) : Logger(level) { +actual class PrintLogger actual constructor(level: Level) : Logger(level) { override fun display(level: Level, msg: MESSAGE) { println("[$level] $KOIN_TAG $msg") diff --git a/core/koin-test-junit4/src/main/kotlin/org/koin/test/KoinTestRule.kt b/core/koin-test-junit4/src/main/kotlin/org/koin/test/KoinTestRule.kt index af566b5e0..e11a02aa8 100644 --- a/core/koin-test-junit4/src/main/kotlin/org/koin/test/KoinTestRule.kt +++ b/core/koin-test-junit4/src/main/kotlin/org/koin/test/KoinTestRule.kt @@ -19,6 +19,7 @@ import org.junit.rules.TestRule import org.junit.rules.TestWatcher import org.junit.runner.Description import org.koin.core.Koin +import org.koin.core.annotation.KoinInternalApi import org.koin.core.context.startKoin import org.koin.core.context.stopKoin import org.koin.dsl.KoinAppDeclaration @@ -30,6 +31,7 @@ import org.koin.mp.KoinPlatformTools * @author Nick Cipollo * @author Jan Mottl */ +@OptIn(KoinInternalApi::class) class KoinTestRule private constructor(private val appDeclaration: KoinAppDeclaration) : TestWatcher() { private var _koin: Koin? = null diff --git a/core/koin-test/src/commonMain/kotlin/org/koin/test/check/CheckModules.kt b/core/koin-test/src/commonMain/kotlin/org/koin/test/check/CheckModules.kt index 997b7eafc..44a6e4cd1 100644 --- a/core/koin-test/src/commonMain/kotlin/org/koin/test/check/CheckModules.kt +++ b/core/koin-test/src/commonMain/kotlin/org/koin/test/check/CheckModules.kt @@ -14,6 +14,7 @@ * limitations under the License. */ @file:Suppress("UNUSED_PARAMETER") +@file:OptIn(KoinInternalApi::class) package org.koin.test.check