Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
systematic base-level generics (mis)configuration results in improper/forced downstream (over)casting use- which propagates further abuse/misuse of generic types. this PR rectifies those base-level issues and all existing classes that use them.
below is a general description of PR code changes or jump directly to PR code diffs and refer to the description here as contextual reference for code changes.
note: although numerous, each PR change is quite small, including unit tests- which all continue to pass.
to that end, i've also introduced jacoco code-coverage metrics/report plugin as a part of this PR. jacoco is lightweight java developer community standard unit/integration- testing tool which integrates automatically into maven build process (via maven-surefire plugin) and generates useful visual/navigable metrics for every class' code coverage/un-coverage.
to view/nagivate the report/metrics- perform your build as usual then simply point a browser to:
nostr-java-test/target/site/jacoco-aggregate/index.html
description of PR changes:
IElement
since IElement is not appropriate for classes which are not nips:
Filters
GenericTagQuery
the use of:
GenericTagQuery implements IElement
Filters extends BaseEvent (which implements IElement)
are now refactored to proper form:
GenericTagQuery
Filters
IDecoder
IDecoder<IElement>
now properly properly genericized asIDecoder<T extends IElement>
formerly used via:
GenericEventDecoder implements IDecoder<BaseMessage>
Nip05ContentDecoder implements IDecoder<BaseMessage>
BaseMessageDecoder implements IDecoder<BaseMessage>
GenericTagDecoder implements IDecoder<BaseMessage>
BaseTagDecoder implements IDecoder<BaseMessage>
now refactored to proper generic form:
GenericEventDecoder<T extends GenericEvent> implements IDecoder<T>
Nip05ContentDecoder<T extends Nip05Content> implements IDecoder<T>
BaseMessageDecoder <T extends BaseMessage> implements IDecoder<T>
GenericTagDecoder <T extends GenericTag> implements IDecoder<T>
BaseTagDecoder <T extends BaseTag> implements IDecoder<T>
decoding non-NIP classes
since IElement is not appropriate for classes which are not nips:
Filters
GenericTagQuery
the use of
IDecoder<IElement>
is contextually incorrect for those classes.FDecoder<T>
has been introduced for them instead.formerly used via:
FiltersDecoder implements IDecoder<Filters>
FiltersListDecoder implements IDecoder<FiltersList>
GenericTagQueryDecoder implements IDecoder<GenericTagQuery>
now refactored to proper generic form:
FiltersDecoder implements FDecoder<Filters>
FiltersListDecoder implements FDecoder<Filters>
GenericTagQueryDecoder<T extends GenericTagQuery> implements FDecoder<T>
IEncoder
IEncoder<IElement>
now properly properly genericized as:
IEncoder<T extends IElement>
formerly used via:
BaseEventEncoder implements IEncoder<BaseEvent>
BaseMessageEncoder implements IEncoder<BaseMessage>
GenericTagEncoder implements IEncoder<GenericTag>
now refactored to proper generic form:
BaseEventEncoder <T extends BaseEvent> implements IEncoder<T>
BaseMessageEncoder<T extends BaseMessage> implements IEncoder<T>
GenericTagEncoder <T extends GenericTag> implements IEncoder<T>
encoding non-NIP classes
since IElement is not appropriate for classes which are not nips:
Filters
GenericTagQuery
the use of
IEncoder<IElement>
is contextually incorrect for those classes.FDecoder<T>
has been introduced for them instead.formerly used via:
FiltersEncoder extends BaseEventEncoder (which implements IEncoder<T>)
FiltersListEncoder extends BaseEventEncoder (which implements IEncoder<T>)
GenericTagQueryEncoder implements IEncoder<GenericTagQuery>
now refactored to proper generic form:
FiltersEncoder implements FEncoder<T>
FiltersListEncoder implements FEncoder<T>
GenericTagQueryEncoder<T extends GenericTagQuery> implements FEncoder<T>
deserializers
JsonDeserializer<[some explicit type]>
now properly properly genericized asJsonDeserializer<T>
formerly used via:
CustomGenericTagQueryListDeserializer extends JsonDeserializer<GenericTagQueryList>
CustomGenericTagQueryListSerializer extends JsonSerializer<GenericTagQueryList>
CustomPublicKeyListDeserializer extends JsonDeserializer<PublicKeyList>
CustomEventListDeserializer extends JsonDeserializer<EventList>
CustomIdEventListSerializer extends JsonSerializer<EventList>
CustomBaseListSerializer extends JsonSerializer<BaseList>
now refactored to proper generic form:
CustomGenericTagQueryListDeserializer<T extends GenericTagQueryList<U>, U extends GenericTagQuery> extends JsonDeserializer<T>
CustomGenericTagQueryListSerializer <T extends GenericTagQueryList<U>, U extends GenericTagQuery> extends JsonSerializer<T>
CustomPublicKeyListDeserializer <T extends PublicKeyList<U>, U extends PublicKey> extends JsonDeserializer<T>
CustomEventListDeserializer <T extends EventList<U>, U extends GenericEvent> extends JsonDeserializer<T>
CustomIdEventListSerializer <T extends EventList<U>, U extends GenericEvent> extends JsonSerializer<T>
CustomBaseListSerializer <T extends BaseList<U>, U extends BaseEvent> extends JsonSerializer<T>
INostrList
since
interface INostrList<T> extends IElement
exclusively pushes List responsibilies up to implementing classes, it has been converted to an abstracdt class w/ generic behavior refactored into it.formerly used via:
BaseList<T> implements INostrList<T>
now refactored to proper generic form:
BaseList<T extends BaseEvent> extends INostrList<T> implements IElement
and it's subclasses formerly used via:
EventList extends BaseList<GenericEvent>
now refactored to proper generic form
EventList<T extends GenericEvent> extends BaseList<T>
BaseList
since BaseList is not appropriate for classes which are not nips:
FiltersList
the use of
extends BaseList<[some explicit type]>
is contextually incorrect for those classes.FNostrList<T>
has been introduced for them instead.formerly used via:
GenericTagQueryList extends BaseList<GenericTagQuery> (which implements INostrList<T>)
PublicKeyList extends BaseList<PublicKey>
KindList extends BaseList<Integer> (which implements INostrList<T>)
now refactored to proper generic form
GenericTagQueryList<T extends GenericTagQuery> extends FNostrList<T>
PublicKeyList <T extends PublicKey> extends INostrList<T>
KindList extends FNostrList<Integer>
Filters
formerly
Filters extends BaseEvent
now simply:
Filters