Currently I'm trying this way:
element.enclosedElements.filter { it.kind == ElementKind.FIELD }.filter {
it.modifiers.contains(Modifier.FINAL) &&
!it.modifiers.contains(Modifier.STATIC)
}
but the problem with this way is that it is also returned member fields that are not in the constructor.
data class Post(
val id: Int,
val title: String,
val content: String?,
val a: Char,
val b: Char?,
val author_id: Int?,
val is_public: Boolean,
val is_updated: Boolean?,
) {
private val myCustomField = true // I don't need this field when processing this class in annotation processor.
}
Note: I've tried this library: https://github.com/Takhion/kotlin-metadata but this library doesn't support the latest version of Kotlin.
Thanks.