Status of Annotations on typealias - supported?

Hi

The original KEEP for typealias suggests that annotations on typealias will be supported:

Q: Are annotations on type alias declarations going to be supported?
A: Yes. Just like annotations on properties, they’ll be stored on synthetic methods in JVM binaries.

This doesn’t appear to be working yet – is this on the roadmap in any upcoming release?

Thanks

Annotations on type aliases should be already supported.

Could you show the particular case where they do not work?

That’s great news – thanks!!

I’m unclear how to access them.

In the given example:

@DataAttribute("http://foaf/FirstName")
typealias FirstName = String
@DataAttribute("http://foaf/LastName")
typealias LastName = String

@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.TYPEALIAS)
annotation class DataAttribute(val value:String)

data class Person(val firstName: FirstName, val lastName: LastName)

How are the annotations associated with FirstName and LastName accessed via reflection?

Unfortunately, there’s no API currently to get annotations from a typealias declaration in kotlin-reflect. I’ve reported an issue: https://youtrack.jetbrains.com/issue/KT-21489