前景提要
在 kotlin 中有必要用常量注解吗?如果需要用下面的常量类用 kotlin 应该怎么写呢,直接转换 kotlin 会报错。 import androidx.annotation.StringDef; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * @author Luke * @version 1.0.0 * @time 2020/7/13 2:14 PM * @description 常量池 */ public class Constant { @IntDef({ AlertCode.SYSTEM, }) @Documented @Retention(RetentionPolicy.SOURCE) @Target({ElementType.PARAMETER, ElementType.FIELD, ElementType.METHOD}) public @interface AlertCode { int SYSTEM = 0; } }