Skip to content

WIP Kotlin extension function generation - #1362

Open
blipinsk wants to merge 1 commit into
JakeWharton:masterfrom
blipinsk:ktx
Open

WIP Kotlin extension function generation#1362
blipinsk wants to merge 1 commit into
JakeWharton:masterfrom
blipinsk:ktx

Conversation

@blipinsk

Copy link
Copy Markdown

This is a followup of the #1016 issue.

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

@blipinsk

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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