-
Notifications
You must be signed in to change notification settings - Fork 60
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
ApplicationVariants.all conversion #19
Comments
Further more:
should be converted to
To improve it further: |
Oh ohhh.. Makes sense. I can add a comment before it like // HEY THIS IS BROKEN or just add what you suggested, but I'm not sure how it would work in more complex scenarios. Do you have a few examples? It doesn't look too complex to implement. |
|
This is the usage of the code I wrote above |
Something like: |
In groovy we have
applicationVariants.all { variant -> //do stuff }
but, when converting to kotlin, the same block of code changes it's functionality:
applicationVariants.all { variant -> //do stuff }
This is due the fact that in groovy the closure given as a parameter to .all method can rename it's receiver (in this case it's renamed to variant).
BUT the same block code in kotlin is not a closure anymore, it becomes a lambda. The ".all" method called now is the one in the Iterable interface. (before it was calling the .all inside DomainObjectSet<> interface)
The real kotlin correspondent is:
applicationVariants.all { val variant = this //do stuff }
.I do not expect your converter to go so deep into the conversion, but please add this information to this wiki as it is very tricky to observe it
The text was updated successfully, but these errors were encountered: