pjfanning commented on PR #146:
URL:
https://github.com/apache/incubator-pekko-connectors/pull/146#issuecomment-1584293467
> @pjfanning Ah I noticed the core problem, just use `enqueueAll` instead of
`enqueue` (otherwise the solution is exactly the same)! `ByteString` is
actually an iterator/collection and so `enqueueAll` is what we should be using,
the definition of both of these functions should make it clear
>
> ```scala
> @deprecated("Use `enqueueAll` instead of `enqueue` to enqueue a
collection of elements", "2.13.0")
> @`inline` final def enqueue[B >: A](iter: scala.collection.Iterable[B])
= enqueueAll(iter)
>
> /** Creates a new queue with all elements provided by an `Iterable`
object
> * added at the end of the old queue.
> *
> * The elements are appended in the order they are given out by the
> * iterator.
> *
> * @param iter an iterable object
> */
> def enqueueAll[B >: A](iter: scala.collection.Iterable[B]): Queue[B] =
appendedAll(iter)
> ```
>
> In other words the current version is calling `def enqueue[B >: A](iter:
scala.collection.Iterable[B]) = enqueueAll(iter)` which is deprecated in 2.13
and `ByteString` is a subtype of `scala.collection.Iterable`.
That doesn't compile in Scala 2.
```
[error]
/Users/pj.fanning/code/incubator-pekko-connectors/json-streaming/src/main/scala/org/apache/pekko/stream/connectors/json/impl/JsonStreamReader.scala:52:52:
type mismatch;
[error] found : org.apache.pekko.util.ByteString
[error] required: Iterable[org.apache.pekko.util.ByteString]
[error] buffer = buffer.enqueueAll(ByteString(value.toString))
[error] ^
[error] one error found
```
buffer is Queue[ByteString] so only ByteStrings can be queued. ByteString
might be an Iterable[Byte] but that is not compatible with Queue[ByteString].
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]