kennyyi
08/11/2018, 5:58 AMfun foo(clazz: Class<*>) {
  // 1. How to know clazz is collection?
  // 2. How to know T of Collection<T> is String?
}
fun myFunc() {
  val mySet: HashSet<String> = HashSet()
  foo(mySet::class.java)
}diesieben07
08/12/2018, 4:30 PMHashSet<String>HashSet<Foo>HashSetreifiedkennyyi
08/13/2018, 6:42 AMannotation class ElementType(val element: KClass<*>)
...
@ElementType(String::class)
class Names: HashSet<String>()
...
foo() {
    ...
    val elementType = clazz.annotations.find{ it is ElementType }
    elementType?.let {
        val elementClass = (elementType as ElementType).element
        ...
    }
    ...
}