I have the following field extension
import com.google.gson.annotations.SerializedName
val Enum<*>.serializedName: String get() = javaClass.getField(name).getAnnotation(SerializedName::class.java).value
Now if my enum has the same field name as serializedName
extension, how could I access the extension field.
My current approach is to cast to Enum
enum class MyEnum {
FIELD_1,
FIELD_2
;
val serializedName = (this as Enum<*>).serializedName
}