Skip to content

Cleanup event generics#1

Open
xor-freenet wants to merge 3 commits into
nextfrom
bertm_cleanup-event-generics
Open

Cleanup event generics#1
xor-freenet wants to merge 3 commits into
nextfrom
bertm_cleanup-event-generics

Conversation

@xor-freenet
Copy link
Copy Markdown
Owner

@xor-freenet xor-freenet commented May 5, 2018

Copy of the pull request on the repository of freenet since I don't have access to that repository anymore: hyphanet#27

EDIT 2025-06-30:
I have NOT forgotten about this PR! :)

The event-notifications API is currently just not the top priority, the priority is finishing the IdentityFetcher-rewrite which I have been working on for 85 branches now. Given it's been taking that many branches and thus that much time I do not want to get distracted too much, hence I've put this PR on hold.

I will deal with it once the IdentityFetcher-rewrite has been released.

* 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants