I'm writing a wrapper that takes a Scala ObservableBuffer
and fires events compatible with the Eclipse/JFace Databinding framework.
In the Databinding framework, there is an abstract ObservableList
that decorates a normal Java list. I wanted to reuse this base class, but even this simple code fails:
val list = new java.util.ArrayList[Int]
val obsList = new ObservableList(list, null) {}
with errors:
illegal inheritance; anonymous class $anon inherits different type instances of trait Collection: java.util.Collection[E] and java.util.Collection[E]
illegal inheritance; anonymous class $anon inherits different type instances of trait Iterable: java.lang.Iterable[E] and java.lang.Iterable[E]
Why? Does it have to do with raw types? ObservableList
implements IObservableList
, which extends the raw type java.util.List
. Is this expected behavior, and how can I work around it?
ArrayList[String]
orArrayList[java.lang.Integer]
?) – VolansObservableList
? Isn't this some kind of a partial function? In Java that would be inheritance, but why would you want to inherit it? – SneerObservableList
is abstract but with no abstract methods. I need the curly braces to instantiate an anonymous subclass. – Aime