Delegation and java class


#1

Hi,

I would like to do something like that :

trait OptimList:List<Stuff>, Deque<Stuff>
class OptimListImp (list:LinkedList<Stuff> : OptimList by list

It seems to be impossible or did I miss something?
Cheers,
Gaetan


#2

This is a bug. The root cause is this issue: http://youtrack.jetbrains.com/issue/KT-1965


#3

Hi Andrey,

«This is a bug». You mean that it should work or not? I don’t see the link beetween the bug and this case.

In my case the trait OptimList doesn’t extend any classes. It extends 2 java.util interfaces. As a LinkedList also implements these interfaces, it would be interesting to allow that my OptimList implementation delegates the List and Deque method call to a LinkedList.


#4

It should work. Your trait indirectly extends java.lang.Object that is extended by all Java interfaces


#5

Ok, thanks for your answer. I will do without for the moment.