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

WIP Kotlin extension function generation #1362

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

WIP Kotlin extension function generation #1362

wants to merge 1 commit into from

Conversation

blipinsk
Copy link

This is a followup of the #1016 issue.

So far it is empty, to figure out details of the implementation.

@blipinsk
Copy link
Author

@JakeWharton I'm starting to work on this feature (generating extension functions).
I would like make sure we're on the same page in terms of the way you would like to have the feature implemented into the library. That's why I'm starting the PR early (without any code), mostly for the discussion purposes.

  1. Base extension functions in a new module (e.g. butterknife-ktx) so it can be used parallely with butterknife or butterknife-reflect
  2. Extension function generation included in the original butterknife-compiler module.

sounds good?

@JakeWharton
Copy link
Owner

They don't need to be in new modules. The Kotlin dependency can be marked as optional and we can hide the enclosing class from Java callers.

@blipinsk
Copy link
Author

They don't need to be in new modules. The Kotlin dependency can be marked as optional and we can hide the enclosing class from Java callers.

Alright, would you like the base extension functions to works differently for both "modes"? Or the same?

  1. If the base extension function (i.e. Activity.bind()) is called for butterknife, it means that there is something wrong with the extension function generation. Throw exception?
  2. If the base extension function is called for butterknife-reflect everything is correct so we're passing the call for Butterknife.bind(this).

@JakeWharton
Copy link
Owner

I would call ButterKnife.bind in both cases so that the extension is still usable for code generation from locations where you only have an Activity reference.

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