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
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