https://github.com/zach-klippenstein/kotlin-interface-delegation-bug
Demo of a Kotlin compiler bug that prevents a Kotlin interface from implementing a Java interface by delegation.
https://github.com/zach-klippenstein/kotlin-interface-delegation-bug
bug demo kotlin kotlin-language
Last synced: about 1 month ago
JSON representation
Demo of a Kotlin compiler bug that prevents a Kotlin interface from implementing a Java interface by delegation.
- Host: GitHub
- URL: https://github.com/zach-klippenstein/kotlin-interface-delegation-bug
- Owner: zach-klippenstein
- Created: 2017-09-04T17:25:54.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-04T18:10:52.000Z (over 7 years ago)
- Last Synced: 2025-01-29T08:11:51.689Z (3 months ago)
- Topics: bug, demo, kotlin, kotlin-language
- Language: Kotlin
- Homepage: https://youtrack.jetbrains.com/issue/KT-20100
- Size: 52.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# kotlin-interface-delegation-bug
Filed as [KT-20100](https://youtrack.jetbrains.com/issue/KT-20100).
Demo of a Kotlin compiler bug that prevents a Kotlin interface from implementing a Java interface by delegation,
when a method on the interface accepts a boxed primitive type.If you have a Java interface that looks like this:
```
public interface Interface {
void doThing(@NotNull Integer arg);
}
```And a Kotlin class that tries implementing it using delegation, like this:
```
class Implementation(delegate: Interface) : Interface by delegate {override fun doThing(arg: Int) {
TODO()
}
}
```The Kotlin compiler will complain about conflicting overloads of the `doThing` method:
```
…/src/main/java/Implementation.kt: (3, 3): Conflicting overloads: public open fun doThing(arg: Int): Unit defined in Implementation, public open fun doThing(@NotNull arg: Int): Unit defined in Implementation
…/src/main/java/Interface.java: (4, 3): Conflicting overloads: public open fun doThing(arg: Int): Unit defined in Implementation, public open fun doThing(@NotNull arg: Int): Unit defined in Implementation
```