I've created a custom annotation in java and I'm trying to use it in a Kotlin written class but in the compile time, I'm getting an error:
Annotation parameter must be a compile-time constant
Here is the code:
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.CLASS)
public @interface EdsFieldInfo {
int persianName();
String columnName() default "";
int domainVals() default -1;
}
This is the place where I'm using the annotation
@EdsFieldInfo(persianName = R.string.customer_file_id, columnName = "FileId")
@ColumnInfo(name = "FileId", typeAffinity = ColumnInfo.TEXT)
var fileId: String?,
and the error is shown here
persianName = R.string.customer_file_id
I try to find a solution for this but couldn't please help me to resolve this matter? Thank you.
persianName = R.string.customer_file_id, culomnName = "FileId"Mostly the suspect:persianName = R.string.customer_file_id-culomnName = "FileId"&name = "FileId"Take a look: stackoverflow.com/a/50679302/4409113