Skip to content

DataStore: deprecate toKotlinObject - #2964

Open
Luna712 wants to merge 2 commits into
recloudstream:masterfrom
Luna712:deprecate-tokotlinobject
Open

DataStore: deprecate toKotlinObject#2964
Luna712 wants to merge 2 commits into
recloudstream:masterfrom
Luna712:deprecate-tokotlinobject

Conversation

@Luna712

@Luna712 Luna712 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor
  1. It can sometimes cause type erasure
  2. It is less clear what it is doing
  3. It is easy to replace
  4. It is very rarely used, all app usage has already been replaced, and I haven't found any extensions actually using it but still following normal deprecation cycle as some still might be using it.

1. It can sometimes cause type erasure
2. It is less clear what it is doing
3. It is easy to replace
4. It is very rarely used, almost all app usage has already been replaced, and I haven't found any extensions actually using it but still following normal deprecation cycle as some still might be using it.
@Luna712

Luna712 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Still needs #2952 and #2958 first

imports = ["com.lagradost.cloudstream3.utils.AppUtils.parseJson"],
),
)
inline fun <reified T : Any> String.toKotlinObject(): T {

@fire-light42 fire-light42 Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we keep this extension function? It should not cause type erasure and it could be renamed for clarity.

Having extension functions helps with chained calls such as:

text.lowercase()
    .substringAfter("[")
    .substringBefore("]")
    .trim()
    .parseJson<>()

And it would be a good complement to toJson()

@Luna712 Luna712 Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should still deprecate this and add the new version to AppUtils then I think. I am a little busy IRL now to work on things though but should be back more next week again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants