Overriding a HtmlRenderer extension function: cannot call super #2435
Labels
enhancement
An issue for a feature or an overall improvement
plugin-api
Everything related to Dokka's plugin API
Is your feature request related to a problem? Please describe
Because Kotlin cannot call the super extension function, it's not possible to override a method from a HtmlRenderer (for example). In this case, either you need to copy/paste (like here) or you need to delegates. Problem with delegates is that you have to use it on the interface and HtmlRenderer and DefaultRenderer are classes, so you cannot use Kotlin delegation on them. Only option remaining is to extends DefaultRenderer, implements the X methods, and delegates manually to a HtmlRenderer... (making it hard to change a bit the rendering)
Describe the solution you'd like
Avoiding extension function for open/abstract methods could be a solution. Fixing KT-11488 could be a cleaner solution.
(For my requirement, an alternative could be to have a way to override code blocks based on language.)
Describe alternatives you've considered
Only viable alternative for me is to duplicate the code from HtmlRenderer, and maintain the copy up-to-date.
Are you willing to provide a PR?
Yes I could, but do we really want to replace extension functions by standard functions? (I mean, code is nice and clean right now...)
The text was updated successfully, but these errors were encountered: