Delegation and java class



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?


This is a bug. The root cause is this issue:


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.


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


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