Indexing classes in compile time


#1

How to find all subclasses of some class? How to find all classes with some annotation?

Fast way is indexing. In Java I can use https://github.com/atteo/classindex but in Kotlin this lib dont work.

I think, Kotlin compiler must make index of all classes in package and store this index in package-info.java. (This feature have Fantom.)


#2

We are considering something aling these lines in Kotlin's reflection support


#3

To get ClassIndex working with Kotlin classes you can now use kapt.

build.gradle:

apply plugin: ‘kotlin-kapt’

kapt ‘org.atteo.classindex:classindex:3.4’