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

Cleanup event generics #27

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

bertm
Copy link
Contributor

@bertm bertm commented Nov 27, 2014

Same as #25, but now as a pull request against master. Refer to the #25 for details.

* Parametrize Notification with generic argument
* Use proper generic types instead of <?> wherever possible on
  Subscription and Notification
* Reduce the amount of (now unnecessary) casting
* Don't write Subscription<? extends EventSource>: the EventType is not
  exposed directly anywhere and there cannot exist any Subscription
  where the EventType does not extend EventSource, given the class
  signature of Subscription. Write Subscription<?> instead when the
  EventType is not known.
* Classes are of type Class<? extends XXX> where XXX is the non-generic
  superclass of XXX<?>. Hence there is no need to ever write
  Class<? extends XXX<?>>, and doing so requires unchecked casts all
  over the place.
The Notification has knowledge of which FCP method to invoke. Moving
this responsibility to Notification instead of the Subscription
considerably reduces the amount of FCP related code duplication and
number of instanceof checks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants