title: Is there a way to force using annotation only on a var property
body: <p>I'm making an annotation processor for encrypting personal data due to law. So in order to encrypt those field it should be able to set new value so I want my annotation to force using only on a var property.</p>
  <pre><code>@Retention(AnnotationRetention.RUNTIME)
  @Target(AnnotationTarget.PROPERTY, AnnotationTarget.FIELD, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
  annotation class PersonalData {
  }
  
  data class CreateAccountCommand(
    @PersonalData
    var fullname: String // it would throw an error if using val since it's not mutable
  )
  
  class TestAnnotation {
    @Test
    fun testFindAnnotation() {
      val message = EasyRandom().nextObject(CreateAccountCommand::class.java)
      val wrappedCommand = GenericCommandMessage.asCommandMessage&lt;CreateAccountCommand&gt;(message)
      if (isPersonalDataPresent(wrappedCommand.payload)) {
        encryptData(wrappedCommand.payload)
        wrappedCommand.payload.fullname shouldContain &quot;-encrypted&quot;
      }
    }
  
    private fun isPersonalDataPresent(payload: Any): Boolean {
      return payload::class.memberProperties.any {
        it.annotations.any { ann -&gt; ann.annotationClass == PersonalData::class }
      }
    }
  
    private fun encryptData(payload: Any) {
      payload::class.memberProperties.map {
        if (it is KMutableProperty&lt;*&gt;) {
          it.setter.call(payload, &quot;${it.getter.call(payload)}-encrypted&quot;)
        }
      }
    }
  }
  </code></pre>
  <p>or any better way?</p>