Skip to content

Instantly share code, notes, and snippets.

@h0tk3y
Last active October 30, 2016 11:00
Show Gist options
  • Select an option

  • Save h0tk3y/cb178ea938bdcfc78bc772755c49c0d8 to your computer and use it in GitHub Desktop.

Select an option

Save h0tk3y/cb178ea938bdcfc78bc772755c49c0d8 to your computer and use it in GitHub Desktop.
// Uses Kotlin 1.0.4 with kotlin-reflect
fun main(args: Array<String>) {
val p = C::x
println(p.javaGetter!!.annotations.toList())
println(p.javaField!!.annotations.toList())
}
@Target(AnnotationTarget.FIELD)
annotation class MyAnnotation
class C {
@MyAnnotation
val x: Int = 0
}
// Output:
// []
// [@MyAnnotation()]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment