How to use Android Support typedef annotations in kotlin?

前端 未结 4 910
别那么骄傲
别那么骄傲 2020-12-13 18:07

I develop Android applications and often use annotations as compile time parameter checks, mostly android\'s support annotations.

Example in java code:



        
4条回答
  •  误落风尘
    2020-12-13 19:05

    There's currently no way to achieve exactly this in Kotlin, since an annotation class cannot have a body and thus you cannot declare a constant in it which would be processed by IntDef. I've created an issue in the tracker: https://youtrack.jetbrains.com/issue/KT-11392

    For your problem though, I recommend you use a simple enum.

提交回复
热议问题