Usage of @specialized in traits

Posted by paradigmatic on Stack Overflow See other posts from Stack Overflow or by paradigmatic
Published on 2012-04-17T15:58:20Z Indexed on 2012/06/27 9:16 UTC
Read the original article Hit count: 306

Filed under:
|
|

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 ?

© Stack Overflow or respective owner

Related posts about scala

Related posts about specialization