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

Allow optional @React annotation of Policy.whenever() methods #1540

Open
alexander-yevsyukov opened this issue Oct 31, 2023 · 1 comment
Open

Comments

@alexander-yevsyukov
Copy link
Contributor

I've just tried to create a couple of stub Policy classes and forgot to add @React annotation on the implemented whenever() methods. This resulted in runtime exception pointing that the contract for the methods is not correct.

We can make it more convenient for the user, making the @React annotation optional in this case (just for the additional clarity). Here's why:

  1. The Policy class assumes that there is only one even handled by it. We don't need to find annotated methods to see what signals a class handles. We know there's gonna be only one. We even check for this on runtime.

  2. The method whenever() is abstract. We know it's going to be overridden. We know the event type handled by the policy by the generic parameter of the class (and the method). Why force the annotation?

@alexander-yevsyukov
Copy link
Contributor Author

There is a GreedyPolicy test env. class in ProtoData code with the associated test. It should be migrated to core-java as an additional result of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

1 participant