How to overcome "same JVM signature" error when implementing a Java interface?

how to overcome sadness
how to overcome loneliness
how to overcome fear
how to overcome depression and anxiety
how to overcome anxiety
how to overcome stress
how to overcome depression in hindi
how to overcome depression - wikihow

With the code below, I am getting the following error in IntelliJ IDEA 13.1.6 and Kotlin plugin 0.11.91.AndroidStudio.3:

Platform declaration clash: The following declarations have the same JVM signature (getName()Ljava/lang/String;):
  • public open fun getName(): kotlin.String?
  • internal final fun <get-name>(): kotlin.String?

Java class,

public interface JavaInterface {
  public String getName();

Kotlin class, KotlinClass.kt

public class KotlinClass(val name: String?) : JavaInterface

I've tried overriding the 'getter' method by adding override fun getName(): String? = name, but that produces the same error.

I can see one workaround by doing this instead:

public class KotlinClass(val namePrivate: String?) : JavaInterface {
  override fun getName(): String? = namePrivate

But in my real-world case I have a number of properties to implement and need setters too. Doing this for each property doesn't seem very Kotlin-ish. What am I missing?

Making that variable private solves the problem.

public class KotlinClass(private val name: String?) : JavaInterface

7 Ways to Overcome Depression Without Medication, Getting support plays an essential role in overcoming depression. On your In order to overcome depression, you have to do things that relax and energize you. Overcome definition, to get the better of in a struggle or conflict; conquer; defeat: to overcome the enemy. See more.

You could use @JvmField for instructs the compiler not generate getter/setter, and you can implement your setters and getters. With this your code work well in Java (as attribute getter/setter) and Kotlin as property

Example: JAVA:

public interface Identifiable<ID extends Serializable> 
   ID getId();


class IdentifiableImpl(@JvmField var id: String) :Identifiable<String> 
   override fun getId(): String 
       TODO("not implemented")

Coping with Depression, Useful information about fear and anxiety and advice on how to overcome it. Exposing yourself to your fears can be an effective way of overcoming this anxiety� Some become quite difficult to overcome, especially when the odds are stacked against us. However, going against the odds is something we're capable of doing. To overcome challenges, develop that "never quit" attitude in life. You'll be surprised at the hurdles you can jump.

Another work-around is to declare the properties in an abstract Kotlin class, then write a small java class that extends KotlinClass and implements JavaInterface.

public interface JavaInterface {
    int getFoo();
    void setFoo(int value);

// KotlinClass.kt
abstract class KotlinClass(open var foo : Int = 0) {

class JavaAdapter extends KotlinClass implements JavaInterface {
    // all code in KotlinClass, but can't implement JavaInterface there
    // because kotlin properties cannot override java methods.

How to overcome fear and anxiety, It's not easy to overcome sadness and depression. Here are 15 ways on how to stop being sad and alleviate the symptoms of anxiety, overcome depression and � Facing Your Fears 1. Identify false beliefs. Many fears are based in false beliefs or catastrophic thinking. When you see a spider, you 2. Try gradual exposure. After you have confronted your false beliefs, begin to expose yourself to the fear. 3. Practice engaging with the fear. The power to

We have found that to use the same names without clashing, the ctor args must be private AND you must still override the interfaces methods. You don't need any additional backing fields. Also, your expression body assignment will not recurse, so you can safely use that syntax.

Java Interface

interface IUser {
    String getUserScope();
    String getUserId();

Kotlin Class

class SampleUser(private val userScope: String, private val userId: String) : IUser {
    override fun getUserId() = userId
    override fun getUserScope() = userScope

15 Simple Ways To Overcome Depression And Sadness, How to Overcome Your Fear of Making Mistakes. by; Alice Boyes. June 24, 2020. Summary Full Text; Save; Share; Comment; Print; PDF; 8.95 Buy Copies. Synonyms for overcome at with free online thesaurus, antonyms, and definitions. Find descriptive alternatives for overcome.

IMHO most readable combination is field + explicit interface implementation by the single-expression function (combination of @Renato Garcia's and @Steven Spungin's answers):


public inteface SomeInterface {
    String getFoo();


class Implementation(@JvmField val foo: String) : SomeInterface {
    override fun getFoo() = foo

How to Overcome Your Fear of Making Mistakes, In order to overcome life's struggles, you'll need to make a plan. Figure out what it is that you need to do in order to succeed at overcoming the challenges you're� Directed by Alex Kendrick. With Alex Kendrick, Priscilla C. Shirer, Cameron Arnett, Shari Rigby. A high-school basketball coach volunteers to coach a troubled teen in long-distance running.

10 ways to overcome life's challenges, I know what it feels like. I suffered from anxiety for years, but I was able to overcome it, and so Duration: 11:56 Posted: 13-Sep-2015

How To Overcome Fear And Anxiety In 30 Seconds, Is it possible to overcome test anxiety? Answer From Craig N. Sawchuk, Ph.D., L.P.. Several strategies can reduce test anxiety and increase your performance�

Test anxiety: Can it be treated?, While there is no quick fix or one-size-fits-all for overcoming depression, the following tips can help you manage depression so it does not�

  • You can not override Java methods with Kotlin properties at the moment. It would be nice if we could support it, but we don't know how to do it consistently for mixed hierarchies
  • what about adding a more desccriptive error message? saying that you can't override java methods with would be less cofusing
  • I guess the best is to rewrite the interface in Kotlin...
  • Any update on overriding getter/setter methods with Kotlin properties? All these answers feel like workarounds to avoid the name clash issue, and most of the time you just want to return the property anyway. @lrn2code This will not work either. If you have a Kotlin class class KotlinClass(var name: String) : SomeInterface and a Kotlin interface interface SomeInterface { fun getName(): String }, this will produce the same error during compilation as using the original Java interface.
  • Ah, I see now. A better solution is to use properties directly in interfaces when rewriting them in Kotlin:… Still doesn't help when you need to work with Java.
  • I don't know if that was possible in Kotlin 0.11, but it works in 1.1 and feels better than having different variable names.
  • If variable needs to be public?
  • Doesn't work for me in Kotlin 1.2: > Class 'KotlinClass' is not abstract and does not implement abstract member public abstract fun getName(): String! defined in JavaInterface
  • This strikes me as the best answer. It directly addresses the issue and works for other cases where the accepted answer won't.
  • Exactly, as @RobertLiberatore said this should be the accepted answer.