Usage of @specialized in traits
- by paradigmatic
I have a trait and an implementation looking like:
trait Foo[A] {
def bar[B >: A: Ordering]: Foo[B]
}
class FooImpl[A]( val a: A, val values: List[Foo[A]] ) extends Foo[A] {
def bar[B >: A] = { /* concrete implementation */}
}
I would like to use the @specialized annotation on A and B to avoid autoboxing. Do I need to use it in both trait and implementation, only in implementation, or only in trait ?