title: How to use StringDef or IntDef in Kotlin?
body: <p>Referring to <a href="https://developer.android.com/reference/android/support/annotation/StringDef" rel="noreferrer">https://developer.android.com/reference/android/support/annotation/StringDef</a>
  <a href="https://developer.android.com/reference/android/support/annotation/IntDef" rel="noreferrer">https://developer.android.com/reference/android/support/annotation/IntDef</a></p>
  
  <p>I could easily create my compile validation which limits my String parameter to specific type of String (in Java)</p>
  
  <p>e.g.</p>
  
  <pre><code>import android.support.annotation.StringDef;
  import java.lang.annotation.Retention;
  import static java.lang.annotation.RetentionPolicy.SOURCE;
  
  @Retention(SOURCE)
  @StringDef({
      "allow_one",
      "okay_two"
  })
  public @interface AllowedString { }
  </code></pre>
  
  <p>So if I have</p>
  
  <pre><code>class TestAnnotation(@AllowedString private val name: String) {
      fun printName(@AllowedString name: String) {}
  }
  </code></pre>
  
  <p>And when I code</p>
  
  <pre><code>val testAnnotation = TestAnnotation("not_allowed")
  </code></pre>
  
  <p>Android Studio will flag error on the <code>not_allowed</code> as it is not in the list.</p>
  
  <p>If I convert to Kotlin the <code>AllowedString</code> annotation interface as below, it doesn't works anymore. Why?</p>
  
  <pre><code>import android.support.annotation.StringDef
  import java.lang.annotation.Retention
  import java.lang.annotation.RetentionPolicy.SOURCE
  
  @Retention(SOURCE)
  @StringDef("allow_one", "okay_two")
  annotation class AllowedString
  </code></pre>
  
  <p>Why?</p>