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
Binary breaking changes in 2.2.0 #975
Comments
All those extensions are unlockable with did you tried |
It does look like I think having the functions deprecated (or even hidden) lets you move toward un-polluting the API while also allowing a transition period for consumers. |
Any way I can convince you to accept a PR re-adding these deprecated functions? I can handle re-adding the removed functions with ERROR-level deprecations and |
I also have this problem. @drewhamilton proposal seems like a win-win situation, since the functions would be deprecated (and even hidden). This would solve a huge headache for our multi-library code base |
Yep, let's check for a proposal. Master is already migrated for 3.0.1. I'm still wondering if I ask people to go from 2.x to new 3.0.1 |
OK, do you have a standard format you'd like me to use for a proposal? Otherwise I can just describe the approach I had in mind:
For example, in //region Deprecated
@Deprecated(
"Replace with ViewModelOwnerDefinition-based overload",
ReplaceWith(
"viewModel(" +
"qualifier = qualifier, " +
"owner = { ViewModelOwner.from(owner) }, " +
"mode = LazyThreadSafetyMode.NONE, " +
"parameters = parameters" +
")",
"org.koin.android.viewmodel.ViewModelOwner"
),
DeprecationLevel.ERROR
)
inline fun <reified T : ViewModel> Scope.viewModel(
owner: ViewModelStoreOwner,
qualifier: Qualifier? = null,
noinline parameters: ParametersDefinition? = null
): Lazy<T> {
return lazy(LazyThreadSafetyMode.NONE) {
getViewModel(
ViewModelParameter(
T::class,
qualifier,
parameters,
owner.viewModelStore
)
)
}
}
@Deprecated(
"Replace with direct call to ViewModelParameter-based overload",
ReplaceWith(
"getViewModel(ViewModelParameter(T::class, qualifier, parameters, owner.viewModelStore))",
"org.koin.android.viewmodel.ViewModelParameter"
),
DeprecationLevel.ERROR
)
inline fun <reified T : ViewModel> Scope.getViewModel(
owner: ViewModelStoreOwner,
qualifier: Qualifier? = null,
noinline parameters: ParametersDefinition? = null
): T {
return getViewModel(ViewModelParameter(T::class, qualifier, parameters, owner.viewModelStore))
}
@Deprecated(
"Replace with direct call to ViewModelParameter-based overload",
ReplaceWith(
"getViewModel(ViewModelParameter(clazz, qualifier, parameters, owner.viewModelStore))",
"org.koin.android.viewmodel.ViewModelParameter"
),
DeprecationLevel.ERROR
)
fun <T : ViewModel> Scope.getViewModel(
owner: ViewModelStoreOwner,
clazz: KClass<T>,
qualifier: Qualifier? = null,
parameters: ParametersDefinition? = null
): T {
return getViewModel(
ViewModelParameter(
clazz,
qualifier,
parameters,
owner.viewModelStore
)
)
}
//endregion Whether you then want to merge this to 3.x/master is up to you. For me, breaking changes from 2.x to 3.x is more expected, so it's the migration from 2.1.x to 2.2.x that is the more important problem to fix. |
let's continue there #996 |
Hi, I saw your comment on #996 but then saw you reopened this issue, should we continue there or here? |
Hi @arnaudgiuliani, my consumers are asking about this again. You indicated some interest, but I was unclear on whether you are in favor of my proposed solution – namely, re-adding removed functions as "deprecated" in a Koin 2.2.x release. If you are in favor I am willing to do this work and open a PR for it. To summarize my proposal:
As a result, 2.2.x will become an "overlap" line, where consumers have the freedom to stop using deprecated APIs and start using KoinComponent etc. |
Hi @arnaudgiuliani , any update on this? |
2.0.1, 2.1.6 & 2.2.2 will be ported to Maven Central Target is Q2 (April/May) |
@arnaudgiuliani thanks but it looks like you are talking about #1004 :) |
Jcenter won't accept any new artifacts very soonly. There is a bit more than the broken APIs. There is also fixes with them :) |
I will close the current issue, as everything should be better in 3.1.3. Please upgrade, as it's has been fixed in 3.1.x. |
@arnaudgiuliani this typealias is gone in v3.1.3, so we still cannot upgrade. Can you put it back in v.3.1.4? |
@fpr0001 yes, I can add it back in 3.1.4. |
If you need more help, come here: #1212 |
Describe the bug
In Koin 2.2.0, some extension functions related to Scope were removed. This causes a binary incompatibility.
To Reproduce
fun <T : Any> T.getScopeId(): String
.getScopeId
is hit at runtime.Expected behavior
The app compiles and runs as before.
Actual behavior
The app compiles, but crashes at runtime with a NoSuchMethodError.
This presents a problem for my team, which ships many libraries which use several such methods (particularly the one in the example, as well as a
Scope.viewModel
extension). Our consumers want to update Koin, but can't because they get this crash. And we can't gradually allow support; we would need to update all of our libraries to Koin 2.2.0 at the same time.I propose to re-add the removed functions with
@Deprecated
markings in a 2.2.x release. They can even be given the ERROR or HIDDEN levels if you want to strongly discourage their use, but we need the runtime compatibility.I would be happy to open a PR for this if it can be shipped in a 2.2.x release.
Koin project used and used version
koin-android-viewmodel
version 2.2.0The text was updated successfully, but these errors were encountered: