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

Relax type resolution constraints #1032

Merged
merged 1 commit into from
Mar 3, 2021
Merged

Conversation

arnaudgiuliani
Copy link
Member

Relax type resolution constraints. Avoid forcing T:Any / KClass

@arnaudgiuliani arnaudgiuliani added this to the 3.0.1 milestone Mar 3, 2021
@arnaudgiuliani arnaudgiuliani merged commit 3981312 into master Mar 3, 2021
@arnaudgiuliani arnaudgiuliani deleted the fix/type_resolution branch March 3, 2021 14:08
@AnonymousWalker
Copy link

AnonymousWalker commented Apr 12, 2021

@arnaudgiuliani
In earlier version I could do this using KoinJavaComponent
val service = get(Service::class.java)

However, since this change I have to add the explicit type
val service: Service = get(Service::class.java)

I am not sure why you change it that way but it would not be as nice (the code is longer and longer), compared to the ktor extension methods where I can just do
val service = get<Service>()

@arnaudgiuliani
Copy link
Member Author

what version do you talk about?

@arnaudgiuliani
Copy link
Member Author

this was effectively a problem in 2.2.x version, due to a "bad" patch

@AnonymousWalker
Copy link

AnonymousWalker commented Apr 13, 2021

I have an added extension that is available for global access to Koin, which was based on the extension methods in ktor pipeline:
org.koin.ktor.ext.KoinApplicationCallExt

Please find the proposed change here:
master...AnonymousWalker:anonymouswalker-koin-common

Usage: val service: Service = get()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants