Hello) I have next annotation in java:
@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD })
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface RepeatedTest {
String CURRENT_REPETITION_PLACEHOLDER = "{currentRepetition}";
String TOTAL_REPETITIONS_PLACEHOLDER = "{totalRepetitions}";
String SHORT_DISPLAY_NAME = "repetition " + CURRENT_REPETITION_PLACEHOLDER + " of " + TOTAL_REPETITIONS_PLACEHOLDER;
int value();
}
When I was converting this code to Kotlin I’ve got the error:
Default value of annotation parameter must be a compile-time constant
@Target(AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.FUNCTION)
@Retention(AnnotationRetention.RUNTIME)
annotation class MyRepeatedTest(val value: Int,
val CURRENT_REPETITION_PLACEHOLDER: String = "{currentRepetition}",
val TOTAL_REPETITIONS_PLACEHOLDER: String = "{totalRepetitions}",
val SHORT_DISPLAY_NAME: String = "repetition " + CURRENT_REPETITION_PLACEHOLDER + " of " + TOTAL_REPETITIONS_PLACEHOLDER
)
How can I change
val SHORT_DISPLAY_NAME: String = "repetition " + CURRENT_REPETITION_PLACEHOLDER + " of " + TOTAL_REPETITIONS_PLACEHOLDER
)
so that won’t get this error?