title: annotations vs annotationEntries in IntelliJ / Kotlin PSI
body: <p>I have a Kotlin annotation:</p>
  
  <pre><code>@Retention(AnnotationRetention.SOURCE)
  @Target(AnnotationTarget.CLASS)
  annotation class Type(
      val type: String
  )
  </code></pre>
  
  <p>It can be used on the Kotlin classes:</p>
  
  <pre><code>@Type(type = "type")
  data class Annotated(
      …
  )
  </code></pre>
  
  <p>I am analyzing this source code with <a href="https://github.com/arturbosch/detekt" rel="nofollow noreferrer">detekt</a> which provides access to the <a href="https://www.jetbrains.org/intellij/sdk/docs/basics/architectural_overview/psi.html" rel="nofollow noreferrer">Kotlin PSI</a>. To get the annotation I use the code like:</p>
  
  <pre><code>val annotation = klass
      .annotationEntries
      .find {
          "Type" == it?.shortName?.asString()
      }
  </code></pre>
  
  <p>where, <code>klass</code> has a type of <code>KtClass</code> from Kotlin PSI. I've noticed, that <code>KtClass</code> has two properties: <code>annotations</code> and <code>annotationEntries</code> and that <code>annotations</code> is empty for the annotated class above.</p>
  
  <p>What is the difference between <code>annotations</code> and <code>annotationEntries</code> and when should I use what?</p>