# Unusual platform declaration clash

**URL:** <https://discuss.kotlinlang.org/t/unusual-platform-declaration-clash/5349>\
**Category:** Support\
**Created:** [November 9, 2017, 9:06am UTC](https://discuss.kotlinlang.org/t/unusual-platform-declaration-clash/5349 "2017-11-09T09:06:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sxtanna](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/sxtanna/32/4134_2.png) [@Sxtanna](https://discuss.kotlinlang.org/u/Sxtanna)\
**Post date:** [November 9, 2017, 9:06am UTC](https://discuss.kotlinlang.org/t/unusual-platform-declaration-clash/5349/1 "2017-11-09T09:06:28Z")

</div>

The interfaces

```
interface IBack0 {

    val name : String

}

```

and

```
interface IBack1 {

    fun getName() : String

}

```

generate the same bytecode

```
public abstract interface {TypeName} {

      // access flags 0x401
      public abstract getName()Ljava/lang/String;
      @Lorg/jetbrains/annotations/NotNull;() // invisible
          LOCALVARIABLE this L{TypeName}; L0 L1 0

     //redacted kotlin metadata

}

```

However in utilization, only the interface using the field is faced with a platform declaration clash when paired with an abstract class

```
abstract class Back0 {

    fun getName() = ""

}

```

![image](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/1/127830debc49f915a8b9a83b9eab48761bd5a1c1.png)

The error being

 ![image](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/e/e5bf6669f0867f1b8015d2b184a3dd37328634cf.png)  
`Class 'Inner0' is not abstract and does not implement abstract member public abstract val name: String defined in com.sxtanna.core.test.IBack0 Inherited platform declarations clash: The following declarations have the same JVM signature (getName()Ljava/lang/String;): fun <get-name>(): String defined in com.sxtanna.core.test.Inner0 fun getName(): String defined in com.sxtanna.core.test.Inner0`

If you attempt to then implement the field from the interface, you are faced with this error

 ![image](https://us1.discourse-cdn.com/flex019/uploads/kotlinlang/original/2X/7/77b1414cd50503ec1e6356d7b2894a07946bcc5f.png)

Is this normal behavior?

---

<div class="post-metadata">

**Author:** ![pdvrieze](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/pdvrieze/32/1882_2.png) [@pdvrieze](https://discuss.kotlinlang.org/u/pdvrieze)\
**Post date:** [November 12, 2017, 7:04pm UTC](https://discuss.kotlinlang.org/t/unusual-platform-declaration-clash/5349/2 "2017-11-12T19:04:16Z")

</div>

From the Kotlin perspective a function and a property are a different thing. Both are incompatible, even though on Java the property when not private (and trivial) is generally implemented as a getter function. That is a platform specific detail, and as such you get a platform declaration clash.

---

<div class="post-metadata">

**Author:** ![Sxtanna](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/sxtanna/32/4134_2.png) [@Sxtanna](https://discuss.kotlinlang.org/u/Sxtanna)\
**Post date:** [November 12, 2017, 9:33pm UTC](https://discuss.kotlinlang.org/t/unusual-platform-declaration-clash/5349/3 "2017-11-12T21:33:53Z")

</div>

I understand why the clash occurs, but what I don’t understand why it has to occur.  
The signature is satisfied with the property, and through Java, the usage would be exactly the same “getName()”. I am sure the compiler would be ok with you referring to it both by “getName()” and “name” since it already does this with Java code used in Kotlin.

---

<div class="post-metadata">

**Author:** ![camdenorrb](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/camdenorrb/32/4137_2.png) [@camdenorrb](https://discuss.kotlinlang.org/u/camdenorrb)\
**Post date:** [February 16, 2018, 6:41pm UTC](https://discuss.kotlinlang.org/t/unusual-platform-declaration-clash/5349/4 "2018-02-16T18:41:31Z")

</div>

I would also like to see this implemented, it would make it more flexible.
