Delegation compilation error


I am puzzled by this:

public class MyArray(val value : MutableList<Any> = ArrayList<Any>())   : MutableList<Any> by value { }

Kotlin: [Internal Error] java.lang.RuntimeException: Error generating primary constructor of class MyArray with kind OwnerKind(implementation) ...

Caused by: java.lang.IllegalStateException: cannot find declaration: fake descriptor has more than one overridden descriptor: public abstract fun <T> toArray(a : jet.Array<out T>) : jet.Array<T> defined in jet.MutableList[SimpleFunctionDescriptorImpl@178b9e6]

The compiler seems to be saying that the inheritance tree of MyArray contains two implementations of the same method, toArray, and it wants me to disambiguate by implementing it myself. How is this possible?  This function might be present in several interfaces but there is only one concrete implementation of it (in ArrayList).

What am I missing?


This is a bug ("Internal error" and a stack trace always indicates a bug). Unfortunatley I can see no straightforward workaround for it, so you may need to resort to manual delegation.


Reported an issue:


Thanks, Andrey. That's a bummer, I'm so excited by the delegation feature :-)

Is there a way to watch this issue so I can be notified by email when it’s being updated? I didn’t find anything.


Click the star icon next to the feature summary