should be compile-time constant



I’m trying out Kotlin. Coming from a C# background, I already saw some people suggesting the nameof function. And I also saw some people recomending using the format in the title.

I was playing around with some annotations and I would like to annotate a field referencing another field in another class, but IntelliJ tells me it’s not possible this way because is not a compile-time constant:


I think it would be really nice if we could do something like that and not have to define constants and loose strings elsewhere in the code. (dunno if it is really possible in java n_n’)

What you guys think?


There’s an open issue about that: KT-16304