haroldadmin / Vector

Kotlin Coroutines based MVI architecture library for Android
https://haroldadmin.github.io/Vector/
Apache License 2.0
193 stars 9 forks source link

Match ViewModel constructor using parameter types instead of number of parameters #19

Closed haroldadmin closed 4 years ago

haroldadmin commented 5 years ago

Describe the bug ConstructorStrategyVMFactoryCreator matches compatible ViewModels using constructor parameter size, not constructor parameters signature.

To Reproduce class TestVM(initialState: MyState, anotherDep: Dependency): VectorViewModel<MyState> When this VM is given to constructor strategy VM factory, it happily accepts it and causes a crash because there are just two constructor parameters.

Expected behavior ConstructorStrategyVMFactoryCreator should reject this ViewModel because it can not instantiate it.

haroldadmin commented 4 years ago

Closed via 5dd1290