Using Room's @ForeignKey as @Entity parameter in Kotlin : <p>I came across a Room <a href="https://android.jlelse.eu/android-architecture-components-room-relationships-bf473510c14a" rel="noreferrer">tutorial</a> that makes use of the <code>@PrimaryKey</code> annotation on the class definition:</p>

<pre><code>@Entity(foreignKeys = @ForeignKey(entity = User.class,
                              parentColumns = "id",
                              childColumns = "userId",
                              onDelete = CASCADE))
public class Repo {
    ...
}
</code></pre>

<p>Now, I have the following data class that want to use a primary key on:</p>

<pre><code>@Parcel(Parcel.Serialization.BEAN) 
data class Foo @ParcelConstructor constructor(var stringOne: String,
                                              var stringTwo: String,
                                              var stringThree: String): BaseFoo() {

    ...
}
</code></pre>

<p>So, I just added the <code>@Entity(tableName = "Foo", foreignKeys = @ForeignKey(entity = Bar::class, parentColumns = "someCol", childColumns = "someOtherCol", onDelete = CASCADE))</code> snippet on the top as well, but I can't compile:</p>

<blockquote>
  <p>An annotation can't be used as the annotations argument.</p>
</blockquote>

<p>I wonder: how come <em>(what I think is)</em> the same concept working in Java but not in Kotlin? Also, is there a way to go around this?</p>

<p>All input is welcome.</p>
