title: Resolving Accidental Override errors in Kotlin
body: <p>I've recently started expirementing with Kotlin and started a Spring Boot pet project using Kotlin.</p>
  
  <p>I'm trying to integrate a custom User domain object to Spring Security and thus want to implement the <a href="http://docs.spring.io/autorepo/docs/spring-security/3.2.1.RELEASE/apidocs/org/springframework/security/core/userdetails/UserDetails.html">UserDetails</a> inteface.</p>
  
  <p>Given my domain User object below:</p>
  
  <pre><code>import org.springframework.data.annotation.Id as DocumentId
  import org.springframework.data.mongodb.core.mapping.Document
  import org.springframework.security.core.GrantedAuthority
  import org.springframework.security.core.authority.AuthorityUtils
  import org.springframework.security.core.userdetails.UserDetails
  
  @Document
  data class User(@DocumentId val id: String? = null,
                  val username: String = "",
                  val password: String = "",
                  val email: String = "",
                  val name: String? = null,
                  val surname: String? = null) : UserDetails {
  
      override fun isCredentialsNonExpired(): Boolean = true
  
      override fun isAccountNonExpired(): Boolean = true
  
      override fun isAccountNonLocked(): Boolean = true
  
      override fun getAuthorities(): MutableCollection&lt;out GrantedAuthority&gt; = AuthorityUtils.createAuthorityList("USER")
  
      override fun isEnabled(): Boolean = true
  }
  </code></pre>
  
  <p>I get the following errors:</p>
  
  <ol>
  <li><p>Accidental override: The following declarations have the same JVM
  signature (getUsername()Ljava/lang/String;): public final fun &lt; get-username>(): Kotlin.String, public abstract fun getUsername(): Kotlin.String!</p></li>
  <li><p>Accidental override: The following declarations have the same JVM
  signature (getPassword()Ljava/lang/String;): public final fun &lt; get-password>(): Kotlin.String, public abstract fun getPassword(): Kotlin.String!</p></li>
  </ol>
  
  <p>Since my User class already has a method getUsername(): Kotlin.String also implement the method getUsername(): Kotlin.String! ?</p>
  
  <p>How am I supposed to resolve such an error, other than using the <a href="http://kotlinlang.org/api/latest/jvm/stdlib/kotlin.jvm/-jvm-name/index.html">@JvmName</a> on the property's getter and setter?</p>