Skip to content

Commit

Permalink
Merge pull request #1915 from InsertKoinIO/module_mapping_isolation_b…
Browse files Browse the repository at this point in the history
…reak_fix

Module Mapping isolation fix
  • Loading branch information
arnaudgiuliani authored Jul 10, 2024
2 parents 13e0913 + 13318ed commit 4177fa5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,6 @@ abstract class InstanceFactory<T>(val beanDefinition: BeanDefinition<T>) : Locka

abstract fun dropAll()

// @Suppress("NAME_SHADOWING")
// override fun equals(other: Any?): Boolean {
// val other = (other as? InstanceFactory<*>)?.beanDefinition
// return beanDefinition == other
// }
//
// override fun hashCode(): Int {
// return beanDefinition.hashCode()
// }

companion object {
const val ERROR_SEPARATOR = "\n\t"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import kotlin.test.assertTrue

val myValModule = module { single { Simple.ComponentA() } }

val myGetModule : Module
get() = module { single { Simple.ComponentA() } }
val myGetModule : Module get() = module { single { Simple.ComponentA() } }

fun myFunModule() = module { single { Simple.ComponentA() } }

Expand All @@ -37,4 +36,13 @@ class ModuleFactoryIsolationTest {
assertEquals(aF.mappings.values.first().beanDefinition, bF.mappings.values.first().beanDefinition)
}

}
@Test
fun testVariableIsolationAndInstanceFactoriesLocal(){
assertTrue(a.mappings != b.mappings)
assertEquals(a.mappings.values.first().beanDefinition, b.mappings.values.first().beanDefinition)
}

}

val ModuleFactoryIsolationTest.a : Module get() = myGetModule
val ModuleFactoryIsolationTest.b : Module get() = myGetModule

0 comments on commit 4177fa5

Please sign in to comment.