Intro: If your project requires generic wild cards that’s too hard for your team’s knowledge level, then sooner or later you need to make a choice.
The complexity may grow out of hands. The compiler errors are non-trivial. Worse still, some Generics errors are runtime errors.
Sugg: see if you can remove generics completely from some classes. Use cast instead.
I feel in most cases, you only need to use "extends" and not "super". I think it can still be too hard.
Here’s one of my projects — the EventQueue project in the 2017 HSBC coding interview. I had to use generic wildcards like
Subscriber<T extends BaseMessage>
SubsriberFilter<T extends BaseMessage>
CallbackTask<T extends BeaseMessage>
When we pass these objects into methods, we face annoying compiler errors or warnings. Most warnings are unnecessary warnings (I think compiler is not smart enough).
Some methods are designed for BaseMessage like …
Other methods are often designed for “T extends BaseMessage”
Yet other methods are designed for a specific subtype PriceMessage.
I feel it’s often easier to use the BaseMessage as argument type. If un-compilable, I often remove the type parameter.
Small tip: if “instanceof ArrayList” gives generics warning, then use ArrayList.class.isInstance().
small tip: use Subscriber<?> can sometimes suppress a warning
small tip: some casts can suppress a warning