title: Correct way to parametrize a generic java event handler
body: <p>I have some code as follows (excerpt):</p>
  
  <pre><code>public interface Event&lt;S&gt; {
      S getSource();
  }
  
  public interface Subscriber&lt;E&gt; {
      void update(E event);
  }
  
  public interface EventPublisher&lt;S, E extends Event&lt;S&gt;&gt; {
      void addSubscription(S source, Subscriber&lt;E&gt; subscriber);
      void removeSubscription(S source, Subscriber&lt;E&gt; subscriber);
  }
  
  public class SubscriptionManager&lt;S, E extends Event&lt;S&gt;&gt; implements Subscriber&lt;E&gt;, EventPublisher&lt;S, E&gt; {
      ...
  }
  
  public class MyEvent implements Event&lt;MyEventSource&gt; {
      ...
  }
  </code></pre>
  
  <p>This all works fine, however, my problem is when I try something like this:</p>
  
  <pre><code>public class MyEventHandler {
      private final SubscriptionManager&lt;Class&lt;? extends Event&lt;?&gt;&gt;, ? extends Event&lt;?&gt;&gt; subscriptionManager = new SubscriptionManager&lt;&gt;();
  
      Subscriber&lt;? extends Event&lt;?&gt;&gt; subscriber = ...;
      subscriptionManager.addSubscription(MyEvent.class, subscriber); **// Compile error**
  }
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>The method addSubscription(Class&lt;? extends Event&lt;?&gt;&gt;, Subscriber&lt;capture#3-of ? extends Event&lt;?&gt;&gt;) in the type SubscriptionManager&lt;Class&lt;? extends Event&lt;?&gt;&gt;,capture#3-of ? extends Event&lt;?&gt;&gt; is not applicable for the arguments (Class&lt;MyEvent&gt;, Subscriber&lt;capture#5-of ? extends Event&lt;?&gt;&gt;)
  </code></pre>
  
  <p>Can anyone tell me what's wrong?</p>
  
  <p>Thanks</p>