Ok, I need some help figuring this out.
I want to implement Java's Collection interface on a Ceylon object that wraps a Ceylon Iterable like this:
shared class JavaCollection<T>({T*} items) satisfies JCollection<T> { }
But there's one method that's giving me trouble, in the Java interface it's:
Object[] toArray()
which gets translated in Ceylon to:
shared actual ObjectArray<Object> toArray() { }
I'm trying something like this:
shared actual ObjectArray<Object> toArray() => arrays.toObjectArray(items);
but obviously the the toObjectArray() method returns a T[], not an Object[].
I thought I could maybe change the signature to return ObjectArray<Anything> but that can't work either.
So is there a way to make this work in Ceylon or am I stuck with implementing this in Java?
-Tako