6

Below is a example of a pattern from Android (Just an example, not interested in android specifics):

/*Im a kotlin file*/
class ListItemViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
    val text: = itemView.my_view
}

Then the pattern is that you access the text field as such:

/*Im a Java file*/
holder.text.setText("Metasyntactic variable");

It's unfortunate to have a large file with a set structure doing the above and then have:

/*Im a Java file, but this particular holder is a kotlin file*/
holder.getText().setText("Metasyntactic variable");

Is it possible to solve this? Maybe with some @Jvm annotation

Adam
  • 2,845
  • 2
  • 32
  • 46