Skip to content
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

Misleading Javadoc for Policy.whenever() #1524

Open
alexander-yevsyukov opened this issue Jul 25, 2023 · 1 comment
Open

Misleading Javadoc for Policy.whenever() #1524

alexander-yevsyukov opened this issue Jul 25, 2023 · 1 comment
Labels
bug docs Documentation and site tasks

Comments

@alexander-yevsyukov
Copy link
Contributor

Now it says:

Handles an event and produces some number of events in response.

The signature is:

@ContractFor(handler = React::class)
    protected abstract fun whenever(event: E): Iterable<Message>

Logically, we can emit not only events, but commands too. It would be also good to bind it on the level of the method signature.

@alexander-yevsyukov alexander-yevsyukov added bug docs Documentation and site tasks labels Jul 25, 2023
@alexander-yevsyukov
Copy link
Contributor Author

There's also a small diagnostic issue in this class. The method checkReceptors() produces the following error:

"Policy `${javaClass.name}` handles too many events: [${classes.joinToString()}]."

This raises a question: “How many is too many?” It should be something like:

"The policy `${javaClass.name}` should react on only one event. Now it handles too many ({$classes.size}): [${classes.joinToString()}]. Please use only `whenever()` method for producing outcoming messages."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug docs Documentation and site tasks
Projects
Status: No status
Development

No branches or pull requests

1 participant