title: 'one to many' / 'many to many' attribute value type should not be '? extends'
body: <p>I'm trying to define a simple Hibernate Mapping using Annotations in Kotlin. But my Many-To-Many Relation is not working as expected. Causing the following error in IntelliJ IDEA:</p>
  
  <blockquote>
    <p>'one to many' / 'many to many' attribute value type should not be '? extends PersonAddress/Person'</p>
  </blockquote>
  
  <p>My codebase:</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>@Entity
  open class Person(
          @Id
          @GeneratedValue(strategy = GenerationType.SEQUENCE)
          var id: Long = 0L,
  
          @OneToMany(mappedBy = "person")
          var addresses: Set&lt;PersonAddress&gt; = setOf() //Fail
  
  )
  
  @Entity
  open class Address(
          @Id
          @GeneratedValue(strategy = GenerationType.SEQUENCE)
          var id: Long = 0L,
  
          @OneToMany(mappedBy = "address")
          var persons: Set&lt;PersonAddress&gt; = setOf() //Fail
  
  )
  
  @Entity
  open class PersonAddress(
          @Id
          var id: Long,
  
          @ManyToOne
          @JoinColumn(name = "person_id")
          var person: Person,
  
          @ManyToOne
          @JoinColumn(name = "address_id")
          var address: Address
  ) : Serializable
  </code></pre>
  
  <p>So as I thought this might be an error caused by the Join-Table, I tried the same for a <code>ManyToMany</code> Relation:</p>
  
  <pre class="lang-kotlin prettyprint-override"><code> @ManyToMany(mappedBy = "addresses")
  var persons: Set&lt;Person&gt; = setOf()
  </code></pre>
  
  <p>But the same error occures here.</p>
  
  <p>Application.kt</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>@SpringBootApplication
  class Application {
      fun main(args: Array&lt;String&gt;) {
          runApplication&lt;Application&gt;(*args)
      }
  }
  </code></pre>
  
  <p>build.gradle.kts</p>
  
  <pre><code>plugins {
      java
      id("org.springframework.boot") version "2.2.5.RELEASE"
      id("io.spring.dependency-management") version "1.0.9.RELEASE"
      kotlin("jvm")
      kotlin("plugin.spring") version "1.3.70"
      kotlin("plugin.jpa")
      kotlin("plugin.allopen") version "1.3.70"
  }
  
  val developmentOnly by configurations.creating
  configurations {
      runtimeClasspath {
          extendsFrom(developmentOnly)
      }
  }
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      implementation("org.springframework.boot:spring-boot-starter-data-jpa")
      implementation("org.springframework.boot:spring-boot-starter-validation")
      implementation("org.jetbrains.kotlin:kotlin-reflect")
      implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
      runtimeOnly("com.h2database:h2")
      developmentOnly("org.springframework.boot:spring-boot-devtools")
      testImplementation("org.springframework.boot:spring-boot-starter-test") {
          exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
      }
  }
  
  allOpen {
      annotation("javax.persistence.Entity")
      annotation("javax.persistence.Embeddable")
      annotation("javax.persistence.MappedSuperclass")
  }
  
  configure&lt;JavaPluginConvention&gt; {
      sourceCompatibility = JavaVersion.VERSION_1_8
  }
  tasks {
      compileKotlin {
          kotlinOptions.jvmTarget = "1.8"
      }
      compileTestKotlin {
          kotlinOptions.jvmTarget = "1.8"
      }
  }
  
  tasks.withType&lt;org.jetbrains.kotlin.gradle.tasks.KotlinCompile&gt; {
      kotlinOptions {
          freeCompilerArgs = listOf("-Xjsr305=strict")
          jvmTarget = "1.8"
      }
  }
  
  tasks.withType&lt;Test&gt; {
      useJUnitPlatform()
  }
  </code></pre>
  
  <p>Edit 1:
  I got rid of the error by using:</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>var persons: MutableList&lt;PersonAddress&gt; = mutableListOf()
  </code></pre>
  
  <p>However walking through my code the error occures on attributes that worked well yesterday.</p>