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

Auto generated MemberInjectors does not compile with Kotlin #92

Closed
damianpetla opened this issue Dec 10, 2014 · 4 comments
Closed

Auto generated MemberInjectors does not compile with Kotlin #92

damianpetla opened this issue Dec 10, 2014 · 4 comments

Comments

@damianpetla
Copy link

I have reported issue on jetbrains bug tracker https://youtrack.jetbrains.com/issue/KT-6446

Basically, MemberInjector rely on property assignment. Even if Kotlin's property is public only setter is available from the java class.

Maybe you can provide some workarounds for this?

@cgruber
Copy link

cgruber commented Dec 10, 2014

So Dagger has no guarantee of being usable by other languages than Java, even if those languages have java-compatible layers, so this issue is out of scope. In particular, I don't know the subtleties that Kotlin has around field assignment at the byte-code level.

That said, based on your bug listed above, you said it seems to fail on fiend injection - I would use setter/method injection as a workaround. MembersInjector will assign using a setter if the setter is annotated with @Inject as opposed to the field.

@cgruber cgruber closed this as completed Dec 10, 2014
@damianpetla
Copy link
Author

I thought that it's not in the scope that's why I reported issue for Kotlin at the first place. I simply hoped that you can find a workaround for me and you did! Thank you. It works!

If I would be more experienced in Dagger I would probably figure it out myself 😄 but I am not. So thanks again!

@cgruber
Copy link

cgruber commented Dec 10, 2014

:) No worries. I commented that way for completeness/clarity.

On Wed Dec 10 2014 at 11:18:37 AM Damian Petla notifications@github.com
wrote:

I thought that it's not in the scope that's why I reported issue for
Kotlin at the first place. I simply hoped that you can find a workaround
for me and you did! Thank you.

If I would be more experienced in Dagger I would probably figure it out
myself [image: 😄] but I am not. So thanks again!


Reply to this email directly or view it on GitHub
#92 (comment).

@naixx
Copy link

naixx commented Dec 27, 2014

@cgruber Is there any magic, that Dagger processor has access to annotations in Kotlin code? Other annotation processing libraries don't have the same success.

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

No branches or pull requests

3 participants