在扩展的注释处理器中,AbstractProcessor
我有:
override fun process(annotations: MutableSet<out TypeElement>, roundEnv: RoundEnvironment): Boolean {
roundEnv.getElementsAnnotatedWith(FxBean::class.java)
.forEach {
val className = it.simpleName.toString()
val metaDataClass = Class.forName("kotlin.Metadata").asSubclass(Annotation::class.java)
val isKotlinClass = it.getAnnotation(metaDataClass) != null
if (isKotlinClass) {
// Trying to get the list of methods
// of the data class with the @FxBean annotation.
val methods = roundEnv.rootElements.find {
it.simpleName.toString() == className // This is never true
}?.let {
val methods = mutableListOf<ExecutableElement>()
it.enclosedElements.forEach {
if (it is ExecutableElement) {
methods.add(it)
}
}
methods
}
}
}
return true
}
我错过了什么?有没有办法获取表示@FxBean
正在处理注释的数据类的元素?