In java I can define enumerated annotation type like this (from here)
// Constants
public static final String WINTER = "Winter";
public static final String SPRING = "Spring";
public static final String SUMMER = "Summer";
public static final String FALL = "Fall";
// Declare the @ StringDef for these constants:
@StringDef({WINTER, SPRING, SUMMER, FALL})
@Retention(RetentionPolicy.SOURCE)
public @interface Season {}
What is Kotlin version of this code?
I have a problem when using this (straight conversion using IDE)
// Constants
private const val WINTER = "Winter"
private const val SPRING = "Spring"
private const val SUMMER = "Summer"
private const val FALL = "Fall"
// Declare the @ StringDef for these constants:
@StringDef(WINTER, SPRING, SUMMER, FALL)
@Retention(AnnotationRetention.SOURCE)
annotation class Season
as I cannot access e.g. Season.WINTER