Modifier and annotation aliasing?


Hi all, just wanted to bring up an issue that I’m not sure has come up before or not. Like a number of other people when I saw that Kotlin was getting type aliases I was like that’s nice but I’ll use that once in a blue moon at best. Personally in my code bases I have noise on the other side of the colon. For example code like this

@Volatile private lateinit var h2provider: H2Provider

is very common and unfortunately some of the first code a new comer to the project will see and also have to write. Ideally I’d love to just be able to make an import and just write something like

service h2provider: H2Provider

Like I said I have no idea if this has come up before or what prior art exists at large for this kind of feature on the JVM. Just a personal pain point.


User-defined modifiers as problematic for language evolution and for tooling, but supporintg “macro annotations” to abbreviate common annotation sets like in your example, is definitely on the table for us