How to make Kotlin Annotation parameter's name explicit declaration mandatory?
// Having an annotation class Foo
annotation class Foo(val bar: String)
// This declaration should work
// we explicitly provided parameter name
@Foo(bar = "42")
class X
// This should fail
// we didn't explicitly provide a name
@Foo("42")
class Y
As far as I understand it's not possible to do with stock Kotlin Compiler and/or IDE? Am I right?
If we're thinking about a custom implementation:
- Is there an existing solution in Kotlin ecosystem?
- Is it possible to implement a guard with a Kotlin Compiler Plugin / KSP?