Hey there, I have an interesting clash between Jav...
# announcements
j
Hey there, I have an interesting clash between Java and Kotlin. Maybe you can help? I have a Java interface I'm trying to implement in Kotlin...
Copy code
public interface Identifiable<T> {
  T getId();
}
I've tried the following...
Copy code
class Product(override val id: String): Identifiable<String>
But i get an error
id overrides nothing
Then I tried:
Copy code
class Product(val id: String): Identifiable<String> {
  fun getId(): String = id
}
But, of course, you get a JVM conflict
The following declarations have the same JVM signature 'public final <get-id>(): String' and 'public open getId(): String'
I found that making
id
private works but that's less than ideal:
Copy code
class Product(private val id: String): Identifiable<String> {
  fun getId(): String = id
}
a
j
Thanks so much for you reply. 😞 🐼