New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add j.u.c.Flow
#4792
Add j.u.c.Flow
#4792
Conversation
The tests we do for pure interfaces are: create instances of it, "upcast" them to the interface type, call methods. This is to make sure that the binary API of the methods declared in the interfaces are actually.correct. |
trait Processor[T, R] extends Subscriber[T] with Publisher[R] | ||
|
||
trait Publisher[T] { | ||
def subscribe(subscriber: Subscriber[T]): Unit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def subscribe(subscriber: Subscriber[T]): Unit | |
def subscribe(subscriber: Subscriber[_ >: T]): Unit |
def onComplete(): Unit | ||
def onError(throwable: Throwable): Unit | ||
def onNext(item: T): Unit | ||
def onSubscribe(subscription: Subscription): Unit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please order the methods according the "Method Detail" section of the JavaDoc (not by alphabetical order).
def cancel(): Unit | ||
def request(n: Long): Unit | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here (so swap them in this case).
ee4f2c2
to
f177c4e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good except for some missing braces in the tests, to adhere to our coding style.
|
||
object FlowTest { | ||
|
||
def makeProcessor[T, R](): Flow.Processor[T, R] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def makeProcessor[T, R](): Flow.Processor[T, R] = | |
def makeProcessor[T, R](): Flow.Processor[T, R] = { |
Same for all the makeX
methods.
According to our coding style:
https://github.com/scala-js/scala-js/blob/main/CODINGSTYLE.md#braces
f177c4e
to
239afae
Compare
Oh, I forgot to add https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.html#defaultBufferSize-- |
239afae
to
7327f8c
Compare
Update: thanks to this interface it is now trivial for users to consume FS2 streams in Laminar/Airstream, without either library knowing about each other. I think that's really cool :) |
https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/Flow.html
Since they are just interfaces, what are we looking for in terms of tests?