I find myself having a strong need for the excellent @DslMarker
on classes from dependencies sometimes. I’m aware that it is possible to use them in functions as seen here
@DslMarker
@Target(AnnotationTarget.CLASS, AnnotationTarget.TYPE)
annotation class TestDsl
fun build1(builder: (@TestDsl DslReceiver1).() -> Unit) {}
But even this isn’t really good enough, because there is no assurance that the @DslMarker
will be applied in all cases (for example in the function apply
).
Is there any way to mark external classes? Are there any plans to add this feature in the future? Using subclasses isn’t an option.