delegate method generation in kotlin

已回答

when working on a Java class in Intellij, I have the possibility to let IntelliJ generate delegate method calls for methods of a field that is defined in the class via Generate/Delegate methods...

This is not possible when working on a Kotlin class. I know that a class can extend an interface and delegate this interface, but what if the object I want to delegate to is not defined by an interface?

Is this a missing feature in the IntelliJ editor that just up to now has not been implemented or am I missing something conceptual?

2

There is an open request at https://youtrack.jetbrains.com/issue/KT-4224, feel free to vote.

In the future please direct all Kotlin specific questions to the forum at https://discuss.kotlinlang.org/.

2

thanks for the info and for the hint to the kotlinlang forum. Wouldn't have thought that an IntelliJ related topic belongs there.

0

Please note that Kotlin has special syntax for delegation built-in into language: https://kotlinlang.org/docs/reference/delegation.html

0

Thanks Serbos for that link. That's definitely a lot cleaner than a bunch of passthrough delegate methods.

0

请先登录再写评论。