Improved return type specialization for methods implemented in super-type
This commit is contained in:
parent
0c76e0f0f6
commit
d3177bf08f
2 changed files with 24 additions and 12 deletions
|
|
@ -261,8 +261,10 @@ object ByteString {
|
|||
sealed abstract class ByteString extends IndexedSeq[Byte] with IndexedSeqOptimized[Byte, ByteString] {
|
||||
override protected[this] def newBuilder = ByteString.newBuilder
|
||||
|
||||
// *must* be overridden by derived classes
|
||||
override def iterator: ByteIterator = null
|
||||
// *must* be overridden by derived classes. This construction is necessary
|
||||
// to specialize the return type, as the method is already implemented in
|
||||
// a parent trait.
|
||||
override def iterator: ByteIterator = throw new UnsupportedOperationException("Method iterator is not implemented in ByteString")
|
||||
|
||||
@inline final override def head: Byte = this(0)
|
||||
@inline final override def tail: ByteString = this.drop(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue