Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Maintenance] removal of @OptIn and @Suppress #1996

Open
wants to merge 2 commits into
base: 4.1.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("DEPRECATION")

package org.koin.androidx.viewmodel.ext.android

import androidx.activity.ComponentActivity
Expand Down Expand Up @@ -64,4 +62,4 @@ fun <T : ViewModel> Fragment.viewModelForClass(
scope = getKoinScope()
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import org.koin.test.android.helper.Helper.componentCallbacks
import org.koin.test.android.helper.Helper.koinComponent
import org.koin.test.android.helper.Helper.koinScopeComponent

@Suppress("OPT_IN_IS_NOT_ENABLED")
@OptIn(KoinInternalApi::class)
class AndroidKoinScopeExtTest : KoinTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:Suppress("DeprecatedCallableAddReplaceWith")

package org.koin.androidx.compose.navigation

import androidx.compose.runtime.Composable
import androidx.lifecycle.*
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelStoreOwner
import androidx.lifecycle.viewmodel.CreationExtras
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
import org.koin.compose.currentKoinScope
Expand Down Expand Up @@ -52,4 +52,4 @@ inline fun <reified T : ViewModel> koinNavViewModel(
return resolveViewModel(
T::class, viewModelStoreOwner.viewModelStore, key, extras, qualifier, scope, parameters
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import org.koin.android.ext.android.getKoin
import org.koin.compose.KoinContext
import org.koin.core.annotation.KoinExperimentalAPI
import org.koin.core.annotation.KoinInternalApi
import org.koin.core.component.KoinComponent
import org.koin.mp.KoinPlatformTools

Expand All @@ -49,7 +47,7 @@ import org.koin.mp.KoinPlatformTools
*/
@Composable
fun KoinAndroidContext(
content: @Composable () -> Unit
content: @Composable () -> Unit,
) {
val context = LocalContext.current
val koinApplication = remember(context) {
Expand All @@ -68,4 +66,4 @@ private fun Context.findContextForKoin(): ComponentCallbacks {
context = context.baseContext
}
return applicationContext as Application
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:Suppress("DeprecatedCallableAddReplaceWith")

package org.koin.androidx.compose

import androidx.compose.runtime.Composable
import androidx.lifecycle.*
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelStoreOwner
import androidx.lifecycle.viewmodel.CreationExtras
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
import org.koin.compose.currentKoinScope
Expand Down Expand Up @@ -52,4 +52,4 @@ inline fun <reified T : ViewModel> koinViewModel(
return resolveViewModel(
T::class, viewModelStoreOwner.viewModelStore, key, extras, qualifier, scope, parameters
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:Suppress("DeprecatedCallableAddReplaceWith")

package org.koin.compose.viewmodel

import androidx.compose.runtime.Composable
import androidx.lifecycle.*
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelStoreOwner
import androidx.lifecycle.viewmodel.CreationExtras
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
import org.koin.compose.currentKoinScope
Expand Down Expand Up @@ -58,4 +58,4 @@ inline fun <reified T : ViewModel> koinNavViewModel(
return resolveViewModel(
T::class, viewModelStoreOwner.viewModelStore, key, extras, qualifier, scope, parameters
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:Suppress("DeprecatedCallableAddReplaceWith")

package org.koin.compose.viewmodel

import androidx.compose.runtime.Composable
import androidx.lifecycle.*
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelStoreOwner
import androidx.lifecycle.viewmodel.CreationExtras
import androidx.lifecycle.viewmodel.compose.LocalViewModelStoreOwner
import org.koin.compose.currentKoinScope
Expand Down Expand Up @@ -57,4 +57,4 @@ inline fun <reified T : ViewModel> koinViewModel(
return resolveViewModel(
T::class, viewModelStoreOwner.viewModelStore, key, extras, qualifier, scope, parameters
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:Suppress("UNCHECKED_CAST")

package org.koin.core.instance

Expand All @@ -24,7 +23,6 @@ import org.koin.core.parameter.emptyParametersHolder
import org.koin.core.scope.Scope
import org.koin.mp.KoinPlatformTools
import org.koin.mp.Lockable
import org.koin.mp.generateId

/**
* Koin Instance Holder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:OptIn(KoinInternalApi::class)

package org.koin.core.module.dsl

import org.koin.core.annotation.KoinInternalApi
import org.koin.core.definition.KoinDefinition
import org.koin.core.module.Module

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:OptIn(KoinInternalApi::class)

package org.koin.core.module.dsl

import org.koin.core.annotation.KoinInternalApi
import org.koin.core.definition.KoinDefinition
import org.koin.dsl.ScopeDSL

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:OptIn(KoinInternalApi::class)

package org.koin.core.module.dsl

import org.koin.core.annotation.KoinInternalApi
import org.koin.core.definition.KoinDefinition
import org.koin.core.module.*
import org.koin.dsl.ScopeDSL

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@file:OptIn(KoinInternalApi::class)

package org.koin.core.module.dsl

import org.koin.core.annotation.KoinInternalApi
import org.koin.core.definition.KoinDefinition
import org.koin.core.module.Module

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ package org.koin.dsl
import org.koin.core.annotation.KoinInternalApi
import org.koin.core.definition.Definition
import org.koin.core.definition.KoinDefinition
import org.koin.core.module.*
import org.koin.core.module.KoinDslMarker
import org.koin.core.module.Module
import org.koin.core.module._scopedInstanceFactory
import org.koin.core.qualifier.Qualifier

/**
* DSL Scope Definition
*/
@OptIn(KoinInternalApi::class)
@Suppress("UNUSED_PARAMETER")
@KoinDslMarker
class ScopeDSL(val scopeQualifier: Qualifier, val module: Module) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class Simple {
class AllFactory2(val strings: MyStringFactory, val ints: MyIntFactory)
}

@Suppress("unused")
class Errors {
class Boom {
init {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package org.koin.core

import org.koin.Simple
import org.koin.core.annotation.KoinInternalApi
import org.koin.core.logger.Level
import org.koin.core.parameter.parametersOf
import org.koin.dsl.koinApplication
import org.koin.dsl.module
import org.koin.mp.KoinPlatformTools
import org.koin.mp.generateId
import kotlin.test.Test
import kotlin.test.assertTrue

@OptIn(KoinInternalApi::class)
class ParameterStackTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package org.koin.core

import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.test.TestResult
import kotlinx.coroutines.test.runTest
import org.koin.Simple
import org.koin.core.annotation.KoinInternalApi
import org.koin.core.logger.Level
import org.koin.core.module.Module
import org.koin.core.module.dsl.singleOf
Expand All @@ -18,7 +16,6 @@ import org.koin.dsl.module
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertNull
import kotlin.test.assertTrue

class ParametersInjectionTest {

Expand All @@ -38,7 +35,6 @@ class ParametersInjectionTest {
assertEquals(42, a.id)
}

@OptIn(KoinInternalApi::class)
@Test
fun inject_param_get_or_null() {
ensureCanInjectParam(
Expand All @@ -63,7 +59,6 @@ class ParametersInjectionTest {
)
}

@OptIn(KoinInternalApi::class)
private fun ensureCanInjectParam(module1: Module) {
val app = koinApplication {
printLogger(Level.DEBUG)
Expand Down Expand Up @@ -355,10 +350,9 @@ class ParametersInjectionTest {
}

@Test
@OptIn(ExperimentalCoroutinesApi::class)
fun `inject across multiple threads`(): TestResult {
val times = 100

return runTest {
val app = koinApplication {
modules(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import org.koin.test.mock.declareMock
import org.mockito.BDDMockito.given
import org.mockito.Mockito

@Suppress("UNCHECKED_CAST")
class DeclareMockTests : AutoCloseKoinTest() {

@get:Rule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import org.koin.test.KoinTest
import org.koin.test.Simple
import org.koin.test.inject

@Suppress("UNCHECKED_CAST")
class DeclareKoinContextFromExtensionTest : KoinTest {

@JvmField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import org.koin.test.mock.declareMock
import org.mockito.BDDMockito.given
import org.mockito.Mockito

@Suppress("UNCHECKED_CAST")
class DeclareMockTests : AutoCloseKoinTest() {

@JvmField
Expand Down
Loading